If you invoke the cpython interpreter with the -i option, it will enter the interactive mode upon completing any commands or scripts it has been given to run. Is there a way, within a program to get the interpreter to do this even when it has not been given -i? The obvious use case is in debugging by interactively inspecting the state when an exceptional condition has occurred.
Share
Set the PYTHONINSPECT environment variable. This can also be done in the script itself:
For debugging unexpected exceptions, you could also use this nice recipe http://code.activestate.com/recipes/65287/