When debugging my django apps I use pdb for interactive debugging with pdb.set_trace()
.
However, when I amend a file the local django webserver restarts and then I cant see what I type in the terminal, until I type reset
.
Is there anyway for this to happen automatically? It can be real annoying, having to cancel the runserver and reset and restart it all the time. I'm told it doesn't happen on other OS's (ubuntu) so is there anyway to make it not happen on the Mac? (I'm using Snow Leopard).
To start execution, you use the continue or c command. If the program executes successfully, you will be taken back to the (Pdb) prompt where you can restart the execution again. At this point, you can use quit / q or Ctrl+D to exit the debugger.
After some scientifically-crafted experimentation, turns out ctrl+Z haults the pdb shell. (Then stty sane to fix the Enter key.) Then you need to kill or resume the pdb shell. To do so, run jobs , then either fg 1 or kill %1 (substituting the job number).
Pausing or Stopping the Debugger To pause a running script, click the Pause button . At this point you can click the Start button to continue running the script, click the Step button to execute the highlighted line of code, or execute additional Python commands.
pdb file holds debugging and project state information that allows incremental linking of a Debug configuration of your app. The Visual Studio debugger uses . pdb files to determine two key pieces of information while debugging: The source file name and line number to display in the Visual Studio IDE.
OK - this works for me I created a ~/.pdbrc and added
import os
os.system("stty sane")
Now each time pdb is run it sets the line settings back to sane.
If I fall out to the terminal then I still have to do it manually - but it solves having to quit runserver and reset all the time.
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