Reputation: 590
I have parent process calling its child. I've put import pdb; pdb.set_trace()
into the child process code.
When I launch the parent with python -m pdb parent.py
it's getting frozen. The debugger doesn't respond to any command I type. But when I hit quit
or continue
it does exits code.
It looks like pdb works, but doesn't produce any output.
$ python -m pdb parent.py
n -m pdb parent.py
> d:\scripts\parent.py(53)<module>()
-> '''
(Pdb) c
It stops responding now.
According to the trace I get after interruption, it was standing at the line just after the pdb.set_trace()
call.
>>>>>>>>>>>>>[2013.06.13-10:02:06] : accessed by child.py
Traceback (most recent call last):
File "child.py", line 40, in <module>
sys.stderr = open(Definition_h.ErrLog, 'a', 0, encoding=Definition_h.utf8)
File "d:\scripts\Definition_h.py", line 863, in unicodeOpen
def unicodeOpen(*args, **kwargs):
File "C:\Program Files (x86)\Python 2.5.4\lib\bdb.py", line 50, in trace_dispatch
return self.dispatch_call(frame, arg)
File "C:\Program Files (x86)\Python 2.5.4\lib\bdb.py", line 79, in dispatch_call
self.user_call(frame, arg)
File "C:\Program Files (x86)\Python 2.5.4\lib\pdb.py", line 134, in user_call
self.interaction(frame, None)
File "C:\Program Files (x86)\Python 2.5.4\lib\pdb.py", line 187, in interaction
self.cmdloop()
File "C:\Program Files (x86)\Python 2.5.4\lib\cmd.py", line 148, in cmdloop
import readline
KeyboardInterrupt: !!!<unprintable KeyboardInterrupt object>
Error in sys.excepthook:
Upvotes: 4
Views: 2154
Reputation: 11970
My mistake was that the script was launched in background mode with the ampersand &
at the end.
So I got the pdb prompt but no command would execute.
Upvotes: 0
Reputation: 590
Actually the problem was that my code was redirecting sys.stdout
to the log file
Upvotes: 7