Jython Remote debugging Intellij Idea, using Pycharm plugin - debugging

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.

Related

Failed to start debugger in Eclipse (Win10)

I am trying to debug a Fortran Console application from Eclipse under Windows 10.
Building and running work fine, using the compiler from MSYS2.
However, starting the debugger yields:
Error in final launch sequence:
Failed to execute MI command:
-exec-run
Error message from debugger back end:
Error creating process /c/Windows/system32/E:/till/uni/wasa/wasa_git/WASA-SED/E:/till/uni/wasa/wasa_git/WASA-SED/wasa_dbg.exe, (error 2).
The gdb.exe is found correctly, but it seems as if the path to the binary is prepended with /c/Windows/system32/ and one time too many the actual path E:/till/uni/wasa/wasa_git/WASA-SED, which obviously causes gdb to fail.
I tried using absolute, relative, and no paths to the binary in the debug configuration settings, all with the same result.
How can I fix this? Thanks in advance.
For me, the problem seems to be related to the version of gdb that I use.
I had used an instance from a recent MSYS2 distribution (i.e. GNU gdb (GDB) 11.1), which produced the error above.
Falling back on an older version (GNU gdb (GDB) 7.9.1) worked as expected.
I solved this by prepending the PATH-variable with the path to the old MSYS2 directory:
SET PATH=c:\mingw4eclipse\bin\;c:\mingw4eclipse\mingw_64\bin\;%PATH%
Putting this into batch file that then calls Eclipse ensures that no other workflows (using the newer MSYS2) are affected.

Pydev -- attach to python_d process (Python debug build) not working

On Windows 7 I have Eclipse Neon (4.6.3) with Liclipse/PyDev, and I am using a custom 64-bit debug build of Python 2.7.13 (python_d.exe, built with Visual Studio using pcbuild.sln). For the most part, this debug build of Python works with PyDev -- I can configure it as an interpreter and make run/debug sessions. However, the "Attach to Process" feature does not work. If I have a "python_d" process running somewhere on the system and try "Attach to Process" in PyDev, the following happens:
The "Process output" dialog window shows the following:
Connecting to 64 bits target
Injecting dll
Dll injected
Allocating code in target process
Writing code in target process
Allocating return value memory in target process
Injecting code to target process
Waiting for code to complete
Attach finished successfully.
[127156 refs]
Process finished with exitValue: 0
A Windows crash dialog appears saying: "python_d.exe has stopped working"
The "python_d" process to which I was attempting to attach gets this message in its output and then crashes: Fatal Python error: UNREF invalid object
In contrast, the attach mechanism works when I use a regular installed release of Python (which I have configured as a separate interpreter in PyDev).
Are debug builds of Python supposed to work with the PyDev debugger attach mechanism? Is this a bug in PyDev? Could PyDev be improperly using a DLL that is only supposed to be used with Release builds of Python? Does PyDev need to be built from source in a different way in order to support debug builds of Python for this purpose?
Debug builds aren't really supported (the Python ABI is different on debug from release and the code which does the attach is shipped as a dll made to expect the Python release version).
As a note, its code lives on https://github.com/fabioz/PyDev.Debugger/tree/master/pydevd_attach_to_process/dll -- if you really feel this is a must have for you, you can try to change it to work with the debug build of Python.
Most specifically, https://github.com/fabioz/PyDev.Debugger/blob/master/pydevd_attach_to_process/dll/python.h probably needs to be adapted for the debug version.

Why does PyCharm say "Unable to display frame variables" in debug mode?

I have several python projects loaded in one pycharm workspace. All but one I can step into normally. One project, however, when I set a breakpoint on, say, the first line of the boilerplate, pycharm says it's Collecting data... for about 10 to 20 seconds then says Unable to display frame variables.
Trying to step over or into the code freezes pycharm for another 20 seconds.
PyCharm still stops at breakpoints, I can see the stack and, with some patience, click on the frames.
I've checked the project configuration and everything seems the same as the other projects, or consistent from one project to another, including the Project, Environment variables, Python interpreter, Interpreter options (none), Script and Working directory.
I've tried running the project in a separate workspace with the same results.
I've reinstalled the debugger as suggested here
I've upgraded to 2016.3
I was using PyCharm 2016.2.3 with Python 2.7.12 :: Anaconda 4.1.1 (x86_64), now PyCharm 2016.3
What am I missing?
You should put the Pycharm Debugger in gevent compatible mode.
File > Settings > Build, Execution, Deployment > Python Debugger > Gevent compatible
The lines you removed probably had a purpose and you shouldn't delete them without knowing the consequences.
The code, which I didn't write myself, contained the following:
from gevent import monkey
monkey.patch_all()
Removing those lines resolved the issue.

Error starting groovyserver \Groovy\Groovy-2.3.3\bin\.. was unexpected at this time

I have just downloaded and installed Groovy 2.3.3 using the Windows installer. While trying to run some of the examples using groovyclient (which tries to start groovyserver), I receive the following error.
\Groovy\Groovy-2.3.3\bin\.. was unexpected at this time.
My Groovy_Home is as follows:
GROOVY_HOME=C:\Program Files (x86)\Groovy\Groovy-2.3.3
The full output is as follows:
C:\Users\Greg>groovyserver
Groovy home directory: "C:\PROGRA~2\Groovy\GROOVY~1.3"
Groovy command path: "C:\PROGRA~2\Groovy\GROOVY~1.3\bin\groovy.bat" (found at GR
OOVY_HOME)
\Groovy\Groovy-2.3.3\bin\.. was unexpected at this time.
I am running on Windows 7 Home Premium - 64 bit
Not sure if this is a universal solution but here's what worked for me on two separate machines running Windows 7 Home Premium (64) and Windows 7 Enterprise (64).
I tried this out with both Groovy 2.2.1 and Groovy 2.3.4
I simply uninstalled Groovy and installed it again, this time outside the Program Files directory. The groovyclient and groovyserver tools started working properly and I no longer get these errors.
Apparently, Groovy has some trouble running the executables if they're installed in Program Files. I'm not sure why this happens. I suspected that it may have something to do with spaces in the catalog's name but I successfully ran groovyclient installed in such a directory ( C:\Groovy\Test groovy with spaces\Groovy-2.2.1 specifically). Therefore, I suspect this has something to do with permissions.
If anyone has an idea why this happens, feel free to expand upon this answer. Maybe the exact reason this error occurs is different and I just managed to work around it by changing the installation directory.

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

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.

Resources