Debugging Externally Launched Code (Celery)
I'm trying remote debugging for the first time and can't get it to trigger. I am trying to debug a problem I'm having getting Celery to run. I've put the import wingdbstub, etc. code in my worker code and set a break point on the print statement.
celery_app.conf.imports = [ 'app_web.tasks.tasks'] import wingdbstub x = 0 / 0 # import pdb; pdb.set_trace() print(True)
When I ran Celery ( celery worker -A celery_worker.celery_app --loglevel=info ), the debugger didn't fire. I added the pdb statements and I got a RuntimeError:WARNING: sys.settrace(<bound method="" bdb.trace_dispatch="" of="" <pdb.pdb="" object="" at="" 0x04c71d90="">>) called: This breaks some debugger functionality. Use 'Ignore this exception location' in the Exceptions tool and restart debugging to suppress this warning but since I didn't get an exception in the IDE I don't see how to ignore it.
I then added the divide by 0 which throws an exception hoping to trigger the debugger but nope. File "D:\SVNRepo\projects-sw\ESI\trunk\env\src\celery_worker.py", line 46, in <module> x = 0 / 0ZeroDivisionError: division by zeroOn Windows celery.exe is starting the process but pdb has been triggering in celery_worker, can I get Wing to trigger?
Win 7/64, Python 3.6.2 (Anaconda), Wing 6.0.7-1 (rev 47fe5b0dd72b), accept debug connections is checked, wingdbstub.py and wingdebugpw are in the same directory as celery_worker.py
You don't want to use pdb and Wing's debugger at the same time. Wing's debugger is a replacement for pdb (with many more features, of course). Did you tell Wing to listen for debug connections? To do that, right click on the bug icon in lower left and check on Accept Debug Connections. If that does not work, try setting kLogFile in wingdbstub.py to see if that indicates why debugging is not starting. You can send that to email@example.com to get help intepreting it.
Accept debug connections is checked and I'd already configured kLogFile to write to the same directory as the other files; at least the first time I tried it I didn't see a log file. I was doing this at home last night and I can't remotely log in now for some reason. The only thing you need to do in Wing is to set a breakpoint? pdb did launch when I was running it alone.
A log file should be created if the process that is being debugged has permission to write to the file. Could you set kExitOnFailure to True? The import wingdbstub should raise an exception with kExitOnFailure set to true; please send the traceback to firstname.lastname@example.orgEither pdb or the wing debugger can be used, but they don't work together because only one debugger can be enabled at a time.