First time here? Check out the FAQ!
1

django shell and wingdbstub

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

 $ python manage.py shell < path-to-script-file.py

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.

Chris Curvey's avatar
226
Chris Curvey
asked 2022-01-26 10:10:36 -0500
Wingware Support's avatar
4k
Wingware Support
updated 2022-01-26 11:26:57 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

Yes, with that command line manage.py 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 path-to-script-file.py. When an exception occurs, Wing still knows that and stops but won't be able to show the code.

Wingware Support's avatar
4k
Wingware Support
answered 2022-01-26 11:26:46 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer