pdb doesn't respond after pdb.set_trace() call

Question:

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:scriptsparent.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:scriptsDefinition_h.py", line 863, in unicodeOpen
    def unicodeOpen(*args, **kwargs):
File "C:Program Files (x86)Python 2.5.4libbdb.py", line 50, in trace_dispatch
    return self.dispatch_call(frame, arg)
File "C:Program Files (x86)Python 2.5.4libbdb.py", line 79, in dispatch_call
    self.user_call(frame, arg)
File "C:Program Files (x86)Python 2.5.4libpdb.py", line 134, in user_call
    self.interaction(frame, None)
File "C:Program Files (x86)Python 2.5.4libpdb.py", line 187, in interaction
    self.cmdloop()
File "C:Program Files (x86)Python 2.5.4libcmd.py", line 148, in cmdloop
    import readline
KeyboardInterrupt: !!!<unprintable KeyboardInterrupt object>
Error in sys.excepthook:
Asked By: astronaut

||

Answers:

Actually the problem was that my code was redirecting sys.stdout to the log file

Answered By: astronaut

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.

Answered By: lolesque
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.