I have a bug in my program :(
The problem is that:
- My
.py
code is long, and takes ages to run - I don't know where the bug is
The good news is that I have a lot of print()
in my py
file, so I can potentially know where the bug lives.
The bad news is that my bug makes my computer crash, so there is no way for me to look at the output of the ipython
console and see what went wrong.
How can I have the output be written to disk while the program runs? So that I can still open the file after reboot to understand what happened before the crash?
This question is different from Redirect stdout to a file in Python?, because I need
- continuous writing to file
- something to use from within Spyder
Many thanks!