stop exeuction and give my a prompt

Jeff Epler jepler at unpythonic.net
Tue Apr 1 19:34:38 EST 2003


On Tue, Apr 01, 2003 at 05:28:26PM -0700, David Bear wrote:
> I would like to have the ability to insert a statement in my code that would 
> stop program execution at that point and give me a python prompt.  I don't 
> know what to call this. 
> 
> What I would like to do is to stop program execution and inspect the state 
> of certain dictionaries --- I don't want to insert a bunch of print 
> statements and watch output fly of the screen.  I'd also like to be able to 
> fiddle with these dictionaries when my program stops.  
> 
> Any pointers?
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 

python -i gives you a prompt when your program would otherwise have
exited.

You should also be able to use something derived from code.interact() to
drop into an interactive console at any time, but exactly how you'd do
this is fuzzy. (by default, code.interact() works in a fresh namespace,
__console__)

Jeff





More information about the Python-list mailing list