Ask Your Question

django shell and wingdbstub

asked 2022-01-26 10:10:36 -0500

Chris Curvey's avatar

updated 2022-01-26 11:26:57 -0500

my current client runs scripts against their Django site using this pattern

 $ python shell <

If I put this in my script file

import wingdbstub
print("Hello World!")

and set a breakpoint at "print", I see that Wing switches into debug mode, but it does not stop at the breakpoint.

Any known issues with trying to use this pattern?

UPDATE: strange...if I have more advanced code in there, and it raises an exception, Wing stops at the exception...but still does not respect the breakpoint.

UPDATE 2: I think I see what's happening. Because the script itself is just "stdin" (due to the redirect), the "import wingdbstub" gets run, but then there no knowledge of what's in the script itself.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-01-26 11:26:46 -0500

Yes, with that command line has no idea where the code is coming from and thus the code object it creates does not have the co_filename attribute set correctly. When that is the case, we cannot know that this code has anything to do with the breakpoints you set in When an exception occurs, Wing still knows that and stops but won't be able to show the code.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2022-01-26 10:10:36 -0500

Seen: 142 times

Last updated: Jan 27 '22