Search code examples
pythonpdb

How to save the debugging info to a file?


I'm using PDB to debug python code, I wonder is there a way to save all the info appeared on the terminal during the whole debugging process to a file? copy-paste is not realistic here.

Help me edit the tags or move this question to a more appropriate place if this question is not proper on stackoverflow.

I guess I need to write a script to track the info on the terminal form the beginning to the end of the debugging process.

Any suggestion is appreciated.


Solution

  • The script command is the most convenient way of doing this in unix based OSes, it lets you save everything that appeared in your terminal to a file. You stop recording with exit or C-d so it can go as long as you want.