So I'm debugging my python program and have encountered a bug that makes the program hang, as if in an infinite loop. Now, I had a problem with an infinite loop before, but when it hung up I could kill the program and python spat out a helpful exception that told me where the program terminated when I sent it the kill command. Now, however, when the program hangs up and I ctrl-c it, it does not abort but continues running. Is there any tool I can use to locate the hang up? I'm new to profiling but from what I know a profiler can only provide you with information about a program that has successfully completed. Or can you use a profiler to debug such hang ups?
Python – How to tell where the python script is hanging
debuggingpython
Related Topic
- Python – How to safely create a nested directory in Python
- Python – How to get the current time in Python
- Python – How to you profile a Python script
- Python – How to add new keys to a dictionary
- Python – How to concatenate two lists in Python
- Python – How to install pip on Windows
- Python – How to remove a key from a Python dictionary
Best Answer
Let's assume that you are running your program as:
Try running your program as:
And have some patience while lots of stuff is printed on the screen. If you have an infinite loop, it will go on for-ever (halting problem). If it gets stuck somewhere, then mostly you are stuck on I/O or it is a deadlock.