Ask Your Question
1

Problem with Wing debugging a python script from terminal

asked 2022-04-02 09:17:10 -0600

piscvau's avatar

updated 2023-01-05 08:35:55 -0600

in Ubuntu 20.04 I want to lauch a python script from terminal window as sudo. I use wingdbstub and it starts OK. I would like the output and input (especially password inputs) to be done from the terminal window. in the debugger preferences. I clicked on the use external console . I added the exo-open --launch TerminalEmulator . Now I can start the program from the terminal window . At first break point I get into the wing debugger and the breakpoint works. But inside a subprocess.run, the debugger does not use the terminal window to ask for password. and keeps waiting for the password!....

edit retag flag offensive close merge delete

Comments

That's odd and sounds like it may be a bug. Does it work if you uncheck the Debugger > Advanced > Use sys.std Wrapper preference?

Wingware Support's avatar Wingware Support  ( 2022-04-06 08:04:52 -0600 )edit

Thanks for our quick response. I cannot try again right now because I modified my project structure and I am no longer able to launch the python script. I will come back later to this.

piscvau's avatar piscvau  ( 2022-04-07 05:50:34 -0600 )edit

yes it works if I unclick the sys.std wrapper

piscvau's avatar piscvau  ( 2022-04-08 13:45:52 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2022-04-08 14:40:07 -0600

Sounds like this is a bug that can be worked around by unchecking the Debugger > Advanced > Use sys.stdin Wrapper preference. I think the problem is that it is getting confused in the child processes about whether it's running in Wing's Debug I/O tool or an external console. Thanks for reporting this problem!

edit flag offensive delete link more
0

answered 2023-01-05 00:35:42 -0600

Python has a debugger , which is available as a module called pdb . It supports setting conditional breakpoints , stepping through the source code one line at a time, stack inspection, and more.

import pdb
msg = "this is a test"
pdb.set_trace()
print(msg)

Insert pdb.set_trace() anywhere and it will function as a breakpoint . When you execute the script by python test.py, you will in the python debug mode.

edit flag offensive delete link more

Comments

The question was specifically about using Wing's debugger for this. I've tried to clarify this in the question title for others that might find this post, since I see it was confusing before. Wing's wingdbstub works similarly to pdb but gives access to the full IDE UI for inspecting data and interacting with the debug process. Details are at https://wingware.com/doc/debug/debugg...

Wingware Support's avatar Wingware Support  ( 2023-01-05 08:40:01 -0600 )edit

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2022-04-02 09:17:10 -0600

Seen: 282 times

Last updated: Jan 05