I'm using Eclipse Luna Service Release 1 (4.4.1) with PyDev 3.9.0.201411111611 for Python 2.7 development, on an ArchLinux (Manjaro) machine.
I have an external script to run my application from command line, using the import pydevd; pydevd.settrace()
template as described in the docs for remote debugging.
The full script is as follows:
#!/usr/bin/python2
import sys
sys.path.append('/home/manu343726/Documentos/myapp/')
sys.path.append('/home/manu343726/.eclipse/org.eclipse.platform_4.4.1_1543616141_linux_gtk_x86_64/plugins/org.python.pydev_3.9.0.201411111611/pysrc/')
from mymodule import main
try:
import pydevd;pydevd.settrace()
except Exception as e:
print e
print ">>>>>>>>ERROR!!! Could not attach to python debugger"
print "*"*50
print "running myapp from source"
print "*"*50
main(sys.argv[1:])
With this settup when I call myapp from command line no exception is thrown from settrace()
, but the script halts on that line and after a couple of minutes refuses the connection to the server. This is the complete traceback:
Could not connect to 127.0.0.1: 5678
Traceback (most recent call last):
File "/home/manu343726/.eclipse/org.eclipse.platform_4.4.1_1543616141_linux_gtk_x86_64/plugins/org.python.pydev_3.9.0.201411111611/pysrc/pydevd_comm.py", line 484, in StartClient
s.connect((host, port))
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused
The PyDev remote debugger is correctly started inside Eclipse, at localhost using the port 5678.
Is there something I'm doing wrong?
I had the same problem and eclipse was not able to get to the python debugger after I upgraded Aptana and pydev.
I had to open a firewall port on my Ubuntu 14.04 machine.
While this is not the best way, things started working again.
sudo ufw allow 5678
Builtin's were also being highlighted before I did this, now pydev is able to resolve such things as True, max and None.
来源:https://stackoverflow.com/questions/26928605/pydev-remote-debugging-not-working-connection-refused