Unclear which version of Python is being used with remote debugging (Eclipse Pydev)
The following tutorials helped me a lot to set up Eclipse Pydev (on my local machine) and remote debugging (on a virtual machine):
http://pydev.org/manual_adv_remote_debugger.html
http://brianfisher.name/content/remote-debugging-python-eclipse-and-pydev
If I understand correctly, the application I am debugging should be running on a remote host. Thus, the application uses the remote Python version.
Now, after pydevd.settrace (), Eclipse (localhost) tells me that it is using local python files in the stacktrace. Is it because of the path mapping in pydevd_file_utils.py (PATHS_FROM_ECLIPSE_TO_PYTHON)? As some of the files are outside of these mappings (like streams).
Imagine the following case: I am debugging my application on a production (virtual) machine (Python 2.4), but my Eclipse is hosted on a newer machine (Python 2.7 by default). Will the application work under remote 2.4 python? Or under local 2.7 python?
source to share
I found the answer. I needed to check this remote debugger.
Let me explain how I found out:
I have a local system with python 2.6.5. In this case, I created a new remote system (virtual machine) using python 2.7.3. Then I split the following script:
import pydevd
print 'hello world'
# call debugger server to handle this breakpoint
pydevd.settrace('10.31.94.156', stdoutToServer=True, stderrToServer=True)
# fron now on the host (debugger server) has control over breakpoints,
# variables, stepping through code etc.
print 'hi again'
import sys
print sys.version # 2.7.3 (default, Sep 26 2013, 20:08:41)
# [GCC 4.6.3]
# now use a 2.7 feature:
x = {i : chr(65+i) for i in range(4)} # dict comprehension
print x # {0: 'A', 1: 'B', 2: 'C', 3: 'D'}
import socket
print socket.gethostname() # my virtual machine name
print 'done'
Of course, I added some breakpoints to Eclipse on my host machine. It's funny to see that the local interpreter gives errors in comprehension of the list, but does . And it also has the x variable displayed nicely in the Debug panel.
Conclusion: The remote interpreter is used to run / evaluate the code. The debugger server helps you in declaring
source to share