Python3 project debugging in Netbeans 6.9.1
This should be quite a popular problem but neither Google nor stackoverlow search helped my with it.
I want to develop Python3 programs in Netbeans 6.9.1. But when I create project, toggle a breakp开发者_StackOverflow中文版oint and press on the Debug button I see following output:[LOG]PythonDebugger : overall Starting
[LOG]PythonDebugger.taskStarted : I am Starting a new Debugging Session ...
[LOG]This window is an interactive debugging context aware Python Shell
[LOG]where you can enter python console commands while debugging
>>> File "/home/proger/.netbeans/6.9/config/nbPython/debug/nbpythondebug/jpydaemon.py", line 219
print self.debuggerFName
^
SyntaxError: invalid syntax
Debug session Abort =1
>>>
And below the log window I see:
ERROR::Server Socket listen for debuggee has timed out(more than 20 seconds wait) java.net.SocketTimeoutException: Accept timed out
So if I understand it right Netbeans tries to debug Python3 code with Jython2.something debugger. Is there a way to attach right debugger?
I met the same problem when using NetBeans. I solved this problem by editing the jpydaemon.py
change the code about 219 line
print self.debuggerFName
==>
print(self.debuggerFName)
Restart NetBeans, and it works.
I don't know how Netbeans work, but from the error message it looks like the Python 3 interpreter gets fed Python 2 code. I would venture that Netbeans hooks a debug server into Python via a breakpoint hook, so when a breakpoint is reached it starts a debugging server that the netbeans IDE then tries to talk to.
This debugserver (jpydaemon.py) evidently has not been ported to Python 3, at least not in your version.
I doubt anything is being executed by Jython. The code in this case seems to be written for Jython as it's called jpydaemon.py, and in any case Jython doesn't support the Python 3 syntax yet, so if you are trying to develop Python 3 code and run it with Jython you are likely to fail quite miserably. :-)
Update: after looking at jpydaemon.py I conclude that I guessed exactly correctly. jpydaemon contains the debugger serveice, which is hooked into the debugging hooks via sys.settrace(). So the problem you are having is quite simple: jpydaemon.py is not ported to Python 3 yet, so you can't use Netbeans internal debugger to debug Python 3 code.
精彩评论