Debugging a Python Program that Hangs

Kay Schluehr kay.schluehr at gmx.net
Wed Dec 3 20:04:44 CET 2008


On 2 Dez., 17:19, Kevin D. Smith <Kevin.Sm... at sas.com> wrote:
> I have a fairly large python program that, when a certain combination
> of options is used, hangs.  I have no idea where it is hanging, so
> simply putting in print statements to locate the spot would be quite
> difficult.  Unfortunately, ctrl-C'ing the program doesn't print a
> traceback either.  Looking through the python debugger documentation, I
> don't see how to run a python program and interactively stopping it
> while it is running.  Is there a way to stop within a running python
> program to see where it is getting hung up?
>
> --
> Kevin D. Smith

You might approximate the critical location using exceptions instead
of prints. That's more costly of course because the program has to be
restarted more often but it will serve the same purpose.



More information about the Python-list mailing list