Remote debugging with WingIDE

Using WingIDE to debug a web application, I set a breakpoint in some Python code that runs when a web form is submitted. Shortly before the breakpoint, I inserted "import wingdbstub" to activate remote deactivation. However, execution does not stop at a breakpoint. I know that the code is running because if I insert "raise exception (sys.modules)" just before the breakpoint, execution stops and a trace appears in my browser, indicating that the wingdbstub file is loaded.

If I hang up the error icon in the status bar, the dialog box says: "There is no process for debugging / listening for connections on TCP / IP 50005. The allowed nodes are 127.0.0.1." I know that I have a โ€œlostโ€ debugging mode when a) the error icon changes from green to white, and b) the buttons on the debug panel disappear (step in, above, out, etc.).

I tried to delete the compiled .pyc files so that they recompile when the next module starts, but the problem remains.

How can I check if Wing is listening on the correct port? The strange thing is that remote debugging worked sometimes, but it doesnโ€™t do most of the time.

Any help would be greatly appreciated. For recording, I use Python 3.1, CherryPy 3.20 and WingIDE Personal 3.2.11.

Alan

+1
source share
1 answer

On Windows, I came across the same behavior that you mention, that is, remote debugging sometimes works, but often gets stuck. I found some useful things to solve this problem:

  • Make sure your firewall is not blocking traffic to / from the ports used by WingIDE and the debugging process. (In my case, I had to unlock both wing.exe files and the program that I was trying to debug in the Windows firewall.)
  • Make sure you haven't accumulated any python zombie processes after failed debugging sessions. They can open a connection to the IDE, making it impossible to connect a newly created instance. (On Windows, you can use the tasklist command to check if python instances are running, and netstat -anp tcp will show any sockets stuck in TIME_WAIT state.)
  • Insert a call to time.sleep(10) right after your import wingdbstub . Run the program from the console, make sure that it is connected in the IDE (the debug icon turns green), then click the "Pause" button in the IDE and then "Exit". (I can't begin to explain why, but it turned out to me a couple of times a couple of times after the debugging connection became awkward.)

The above recommendations are probably applicable to Linux as well, but I only experienced this problem on Windows so far ...

+1
source

All Articles