问题
I upgraded eclipse from 3.6 to 4.2 and Aptana from 2 to 3 with pydev
Now I cannot get the debugger to work. I get the following errors:
Traceback (most recent call last):
File "C:\Google\eclipse\plugins\org.python.pydev_2.6.0.2012062121\pysrc\pydevd.py", line 4, in <module>
from pydevd_comm import CMD_CHANGE_VARIABLE, \
File "C:\Google\eclipse\plugins\org.python.pydev_2.6.0.2012062121\pysrc\pydevd_comm.py", line 78, in <module>
import pydevd_console
File "C:\Google\eclipse\plugins\org.python.pydev_2.6.0.2012062121\pysrc\pydevd_console.py", line 3, in <module>
from code import InteractiveConsole
ImportError: cannot import name InteractiveConsole
!ENTRY org.python.pydev.debug 4 4 2012-07-08 22:09:17.635
!MESSAGE Unexpected error setting up the debugger
!STACK 0
java.net.SocketException: Socket operation on nonsocket: configureBlocking
_at java.net.DualStackPlainSocketImpl.configureBlocking(Native Method)
_at java.net.DualStackPlainSocketImpl.socketAccept(Unknown Source)
_at java.net.AbstractPlainSocketImpl.accept(Unknown Source)
_at java.net.PlainSocketImpl.accept(Unknown Source)
_at java.net.ServerSocket.implAccept(Unknown Source)
_at java.net.ServerSocket.accept(Unknown Source)
_at org.python.pydev.debug.model.remote.ListenConnector.run(ListenConnector.java:57)
_at java.lang.Thread.run(Unknown Source)
回答1:
If you're encountering this error, check to make sure you don't have any other code.py
modules in your PYTHONPATH - ie, in your project. For example I was using web.py and the tutorial has you create a code.py
file - renaming this to main.py
, the debugger was able to import InteractiveConsole
from the correct module (the one in python27\lib).
回答2:
I think that the problem is that the import:
from code import InteractiveConsole
is giving an ImportError. Check if the 'code' module is in your PYTHONPATH (should be at the Python lib: Python/lib/code.py
)
I.e.: Open a shell in the command line:
[07:55:55 X:\]python
Python 2.7.2 (default, Feb 23 2012, 00:24:32) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import code
>>> code.__file__
'c:\\bin\\python-2.7.2\\lib\\code.pyc'
If it's really not there, it's a problem in your Python install (should definitely be there).
来源:https://stackoverflow.com/questions/11388503/after-upgrading-eclipse-aptana-pydev-debugger-not-working