I'm trying to help debug a python script that is causing python (2.7) itself to crashes.
So my question:
GB
If you're only interested in debugging a Python script, the simplest way is to select the down-arrow next to the run button on the editor and select Debug Python File in Terminal.
Python has a built-in debugger called pdb . It's a simple utility with a command line interface that does the main job. It has all the debugger features you'll need, but if you're looking to pimp it up a little, you can extend it using ipdb, which will provide the debugger with features from IPython.
crash-python is a semantic debugger for the Linux kernel. It is meant to feel familiar for users of the classic crash debugger but allows much more powerful symbolic access to crash dumps as well as enabling an API for writing ad-hoc extensions, commands, and analysis scripts. $ pycrash vmlinux-4.12. 14-150.14-default.
So there are no exceptions in the log? It just exits randomly at different spots?
To see every statement as it's executed, use the trace module:
python -u -m trace -t program.py
To run the program in the debugger, use pdb:
python -m pdb program.py
With those two you should be able to see if it's something within the program causing it to exit. If you don't see any evidence or pattern then it could be something outside of the program causing it to die.
On Linux I would also try running the program with strace
and watching for the OOM killer or segfaults. Not sure what similar steps would be in Windows, Windows doesn't have an OOM killer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With