Develop and debug Python 3 applications in a virtual environment with Komodo IDE 8 - debugging

I was trying to develop and debug Python 3 applications in a virtual environment with Komodo IDE.
I applied all the project settings, tried out my tests and did a lot of research using google, stackoverflow and also tried sarchiung the komodo forums for "virtual environment" oder "venv".
My impression is, that this cannot be done at the present. Or is there a way?
How can debugging in a Python3 Virtual Environment be done in the current commercial Komodo IDE version on windows?

Debugging in a Python3 Virtual Environment does not work yet in the current Komode IDE version on windows.
My experience is, that even if the path is properly set on debug sessions in the project settings, those are ignored in the debug session and even worse, Komodo uses c:\Python27 which should not be visible in the session.
Example:
I have c:\python27 and c:\python33 on the system
My Python 3 VENV is in c:\project\demo and I added the python 3 exe from c:\project\demo\scripts\python.exe to the project settings
I also set the environment variabels PYTHONPATH and PATH to
c:\project\demo\scripts\ respectively c:\project\demo\ and c:\project\demo\mylib
Also c:\project\demo\mylib is added to the python3 search paths.
I can run my tests from a VENV from the console withpout any problem, which has exactly the mentioned configuration.
Now I open the file with the test in the Komodo project and run / debug it.
The result is that the debug session cannot import from c:\project\demo\mylib. When I print the environment in the debug session, it shows me that it is set to c:\Python27
I wonder why all those settings exist if the debug session does not use them.

Related

cl.exe is not being found in path variable but works after having been added programatically [duplicate]

Sometimes when I change my environment variables in Windows, and then use software the depends on those variables, they are not properly updated.
And good example is to change a variable, then open up Windows Command Line and echo the variable and see that it hasn't been changed, even though you properly changed it in the Environment Variables window.
Another example I'm dealing with right now:
I've been using Python 2.4.x for a while for a project, which uses the env var PYTHONPATH who's value has been:
C:\Python24;C:\Python24\lib
Today I installed Python 2.5.x for the project. I changed my PYTHONPATH to be:
C:\Python25;C:\Python25\lib
When I use Python 2.5 to run a script and do this:
import sys
print sys.path
It prints:
'C:\\PYTHON24', 'C:\\PYTHON24\\lib' (and some other Python 2.5 related default installation paths)
So clearly, the old PYTHONPATH environment variable changes aren't really sticking....
Does anyone know why this happens and how to fix it?
When you change an environment variable in the System Properties tab, the new value will propagate to the Windows Explorer, and any apps (such as cmd.exe) opened from the Windows Explorer (or the Run box, Start Menu, etc.) should see the new value.
However, if you're running a program such as an editor or python or some non-Microsoft program launcher, then change an environment variable, and then launch cmd.exe from that program (instead of Windows Explorer) you are likely to see the old value of the environment variable. The reason is that the running program ignored the notification from Windows saying that the environment has changed (not at all unusual), and since the launched process inherits the environment variables, the child process won't see the changes.
The workaround is to make sure you start your app from Windows Explorer or the Run box. Rebooting your machine will work also (if rebooting doesn't solve the problem, then something else is going on).

Bash on Windows - debug a python file with Visual Code or Visual Studio

I have a python file in my Bash on Windows environment.
Is it possible to debug it with Visual Code or Visual Studio?
Can a debugger be attached to the Linux python version that exists in the Bash on Windows environment?
I think you've got a few options for this. If you're attempting to debug a python file that's saved on your home directory in Bash on Windows, you can navigate to your home directory in Windows by going to "C:\Users\[windows username]\AppData\Local\lxss\home\[ubuntu username]\". Then you can open any of your projects or files saved on your home folder in Ubuntu. You can even make a shortcut on your desktop or something to make it easier to access this folder.
However, if you need the environment that you have on Bash for dependencies or python modules, your other option is to install a GUI and Linux-compatible IDE of your preference on Ubuntu, and use Xming on Windows to run the IDE on your screen. A tutorial on how to do this can be found here.
If you need to debug a linux python program from Visual Studio, a simple Google search yielded this. I haven't tried it but this seems to be the solution you are looking for. For connecting over the network to Bash on Windows from Windows, use localhost for the host.
Your best bet might be to just move the file. Your normal windows system is mounted under /mnt/c.
You can just copy it to your desktop by doing
cp (path to your file) /mnt/c/(your username)/Desktop
When you need to access or edit it from bash, just cd to that location (or wherever else you choose to store it).
Interesting other idea: you could mount cloud storage (e.g. google drive) via fuse in linux then set it up in windows. Copy the python to it and you can edit in windows and access in linux as needed. (Google is your friend here; look into google-drive-ocamlfuse or gdrivefs).
Hope this helps!
jBit
I would suggest making use of the Remote - WSL extension for Visual Studio code. It allows you to easily access your Windows Subsystem for Linux (WSL) and use it as a full-time dev environment.
Here is an article on how to set up Visual Studio Code Remote-WSL.
After that is set up, you can quickly load your python file in the VS Code editor using a command like: code path/to/python_file.py

The scope and when to run the SetEnv.Cmd of Windows SDK

Sorry about being a newbie for this issue... But I'd really like to know the scope and when to run the SetEnv.Cmd under the Bin folder of the Windows SDK.
Since I only ran it in a command prompt, isn't the environment variable settings I did their only local to that session? Do I need to re-run it after I close that session? I tried and it seems to be that I don't need to, but... Why is this all done in a local session?
Sorry about the naive question,
Shawn
The SDK build tools require environment variables to be configured for the include path, library path, exe path, etc. Each version of the SDK has its own include files, etc. so each version requires different values for the variables. Hence the variables cannot be configured as permanent variables for the user (or system).
Instead, each SDK version provides the SetEnv.cmd batch file to configure the environment for that version of the SDK, and the variables are local to the current command-prompt.
When you install the SDK you get a shortcut created in the Start Menu that opens a command-prompt and runs SetEnv.cmd for you. For example, on my computer I have "Windows SDK 7.1 Command Prompt".

Android studio doesn't start

I just download Android Studio for Windows 7, the wizard went ok up to the end but now when I click on the shortcut or on the .exe to start the program nothing happens, no error, no new window, it's seems like it is doing nothing. Do you have any suggestion?
It's a bug of Android Studio 0.1v
You should add JAVA_HOME to the system environment variables.
http://tools.android.com/knownissues#as0.1
Open Start menu > computer > System Properties > Advanced System
Properties
In the Advanced tab > Environment Variables, add new system
variable JAVA_HOME that points to your JDK folder, for example C:\Program Files\Java\jdk1.7.0_21
Install latest Java Development Kit.
Set path in system variables for Java (ie *C:\Program Files\Java\jdk1.7.0_21\bin*)
Set JDK_HOME system variable (ie *C:\Program Files\Java\jdk1.7.0_21*)
If not working, set JAVA_HOME in system variable too (ie *C:\Program Files\Java\jdk1.7.0_21*)
If not working, check if you don't have spaces at the ends of the lines in system variables (PATH, JDK_HOME, JAVA_HOME)
You don't have to restart computer after changing system variables, just reload command prompt (if you are using it).
If it still not working, you probably have java.exe in C:/Windows/System32/. Rename it, restart command prompt and type java -version to check if you are using correct version of JDK.
I've posted tutorial how to fix Android Studio with screenshots on my blog.
I have had a similar problem with Android Studio 1.0 in windows 7 x64. When I ran studio64.exe it flashed the android studio logo and it disappeared immediately. Also I tried
studio64.exe > error.log
to figure out possible errors. JAVA_HOME=C:\Program Files\Java\jre1.8.0_25 environment variable was correctly setted.
Finally I decided to uninstall all Java versions (I had a mess of different java versions installed), both jdk and jre and reinstalled last version jdk 1.8.0_25. My problem was solved.
Regards,
Sometimes it might get stuck in memory. Open task manager, terminate android stuido. Open it up again.
If you install new the version of android studio.
It requires new jdk 1.8.
Just install the latest jdk 1.8 and android studio will work without the need to manually edit any environment variables.
You have to add a new system variable named ANDROID_STUDIO_JDK or JDK_HOME with the path to your JDK install folder, such as C:\Program Files\Java\jdk1.7.0_21\
I had the same exact problem and did try to do every thing manually nothing worked except for this command when I finished it finally launched. Open CMD with administrator if possible then put the following command:
set path="$PATH":C:\Program Files\Java\jdk1.7.0_21\bin
Then just try to launch it should work.
This is the only thing that worked for me.
Make sure you have Java 1.8 (JDK) or higher and update java_home and path to this version.
I did every tips but i checked AS requirements and updated jdk do 1.8.xx
It's possible there is a problem with your username (and name of the user folder). It shouldn't contain non-latin letters.
I had solved my problem (no response to an attempt to run Android studio) when I tried running the application as another Windows user (with name that consists of English letters only)
I got the same problem, but with no error message.
I found a studio.bat file and dig in it. There, I found some tips:
I found out thet the variable suggested in a previous post is incorrect.
ANDROID_STUDIO_JDK is no good.
STUDIO_JDK is the one.
Also, just to make the things/solution worst to corner,
I've uninstalled jre and jdk then reinstall jdk only.
The setup variables are like this:
JAVA_HOME is now pointing to C:\Program Files\Java\jdk1.8.0_172\bin
JDK_HOME is pointing to C:\Program Files\Java\jdk1.8.0_172
STUDIO_JDK is pointing to C:\Program Files\Java\jdk1.8.0_172
It's a mess but it's working...
Is it because I uninstalled/reinstalled java sdk and jre? or just the env. variables? who knows :)
Specs:
i5 with 4gig ram
win 10 32bit
In addition to following the steps pointed out by Tigris I also had to run the Android Studio with Administrative rights. Not sure why but I just made it in a few minutes ago.
Follow the steps here: http://tools.android.com/knownissues#as0.1
Run Android Studio as Admin
There is Another Issue
http://tools.android.com/knownissues
open a "cmd.exe" (command prompt), cd to the android-studio\bin folder and run "studio.bat". You will most likely see an error: for example b/55267 is about the option -XX:+UseCodeCacheFlushing not being recognized. Report the error, remove the line from the studio.exe.vmoptions or studio64.exe.vmoptions and it should now work.
There could be a process still running in the background that would need to be killed in the task manager. The name of the process is studio64.exe (at least that's the name on my machine). Could be because I am running a 64-bit OS. After killing this process, try to run Android Studio again, and it should work.
If your path and/or environment variables are not pointing to the correct JDK, things won't work properly.
A rock solid solution, especially if you must have multiple JDKs installed (e.g. Java 6/7/8) is to create a batch file to launch Android Studio.
Create a new file called studio.bat and place this somewhere outside the Android Studio installation, e.g.
c:\mydevstuff\launchers\studio.bat
(if you put the batch file anywhere in the android-studio folder, then you'll have problems when updating Android Studio).
Put the following code in the new batch file:
#echo off
REM Can make paths relative to SCRIPT_PATH if necessary
set SCRIPT_PATH=%~dp0
set ANDROID_STUDIO_JDK=<JDK Path>
set JAVA_HOME=<JDK Path>
set PATH=<JDK Path>\bin;%PATH%
cd <android-studio Install Path>\bin
start studio64.exe
Replace studio64.exe with studio.exe if you need the 32-bit version.
Replace
<JDK Path>
with the path to your JDK, e.g.
C:\Program Files\Java\jdk1.7.0_25
Replace
<android-studio Install Path>
with the path to your Android Studio installation, e.g.
C:\Program Files\Android\android-studio
Now you can just run the batch file to start Android Studio.
Additional:
If you want to pin to the Taskbar, then create a shortcut to the batch file and then change it's target to:
cmd.exe /c "<path to bat>\studio.bat"
Then pin this shortcut to the Taskbar by drag-and-drop.
You can also set it's icon from the original Android Studio studio.exe file.
I ran into this problem and these steps fixed it.
Remove ALL older JRE / JDK versions
Set values for JDK_HOME & JAVA_HOME to path of JDK install
if you use android studio version 2.3.3 you should have JDK with version 1.8 in the system environment values ,
to add it
click on Computer (in windows 7)
System properties
Advanced system settings (at the right)
Advanced (tab)
environment variables button
and edit the value of name JAVA_HOME to the file which contains jdk 1.8
if you don't have this variable make a new one

Jython Remote debugging Intellij Idea, using Pycharm plugin

Before marking this as a duplicate please read the full thread
OS - Windows XP
Primary Language - Java
Scripting Language - Jython
IDE - Intellij Idea
Python Plugin - Pycharm
I am trying to remote debug my application which runs in Java and uses Jython as a scripting language. I followed the steps mentioned in the below link
http://www.jetbrains.com/pycharm/webhelp/run-debug-configuration-python-remote-debug.html#commentsSection
I can start the debugger
When my application starts up, it is able to connect to the debugger
However I am getting below critical WARNING -
pydev debugger: CRITICAL WARNING: This version of python seems to be incorrectly compiled (internal generated filenames are not absolute)
pydev debugger: The debugger may still function, but it will work slower and may miss breakpoints
pydev debugger: Related bug: http://bugs.python.org/issue1666807
The problem
Debugger doesn't stop at the break points.
I have searched lot of forums for the possible solutions -
delete all *.pyc files
reinstall python version
extract python lib folder to local file and add to sys.path
None of these work for me.

Resources