saving Python process state for later debugging

aspineux aspineux at gmail.com
Sun Apr 1 13:57:54 CEST 2007


On 1 avr, 09:39, yossi.krei... at gmail.com wrote:
> On Apr 1, 2:07 am, "aspineux" <aspin... at gmail.com> wrote:
>
>
>
> > Pylon has something like that.http://pylonshq.com/docs/0.9.4.1/interactive_debugger.html
>
> > Turbogears has the same with option tg.fancy_exception
>
> I could get it wrong, but these things seem to be about debugging
> crashed processes "online", not saving snapshots to files for later
> inspection. Can you e-mail a process snapshot to a different machine
> with them, for example? I understood that you are supposed to debug
> the original process, which is kept alive, via the web. I'm talking
> about a situation where you have a Python program deployed to a user
> who is not running a web server, and have the user send you a snapshot
> as a bug report.
>
> -- Yossi

A context in python is no more than 2 dictionaries ( globals() and
locals()).
You can easily serialize both to store them.
You can navigate into the python stack using module inspect and
generate the context for all
the functions in the stack trace.

This is probably no more than 50 lines of code, maybe 20 :-)

You can find sample of how to get these info and use them in the
sample I was reffering before.




More information about the Python-list mailing list