I understand mechanically from here:

I can use C-x C-q to disable read-only mode on the python file I am debugging. I can then make changes and use run to restart the debugger.

However, I find that when I do this, whenever I edit the file that I am debugging, I am faced with the following error:

That’s all folks.... exited abnormally with code 1

How can I make changes to a file I am debugging and then re-run it without the debugger crashing? My read is that the file is read-only for a reason, and when I modify it while pdb is running I invite disaster---but this suggests to me there is an approved way to do this correctly. What is it?

  • This is specifically edits in the file I'm running like changing APIs or dependencies. Commented Nov 3, 2020 at 2:44

1 Answer 1


The thing is, the pdb debugger has the file loaded, so when you are editing the file (or buffer), it doesn't change it in the memory of the debugger, so it will ignore the changes until you call it again.

This issue is more related to the debugger itself, realgud it's just making sure of the file consistency, so it doesn't make too much sense to edit it in that scenario.

Still, there is probably a way to "hot reload" the debugger and get back to the pdb previous stage, but it's not implemented.

  • Is realgud uniquely not capable of this? Are other debugger backends that do this more easily? Commented Nov 3, 2020 at 21:27
  • 1
    I'm not aware of any other debugger capable of this, still, you can try it with the Melpa package dap-mode, that has a python backend available
    – Fermin MF
    Commented Nov 3, 2020 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.