drop into the interpreter

brianc at temple.edu brianc at temple.edu
Thu Aug 12 16:54:53 EDT 2004


Trick I use is to throw something into the point you want it
to stop at that will raise an exception. Then run the script
with the -i option. So "python -i script.py". Upon raising the
exception it will return you an interpretter prompt. 

There's also a very good thread on Guido's blog about how to
design main() functions so they're easily usable from the
interpretter. 
http://www.artima.com/weblogs/viewpost.jsp?thread=4829

-Brian

---- Original message ----
>Date: Thu, 12 Aug 2004 22:11:15 +0200
>From: "Martin v. Löwis" <martin at v.loewis.de>  
>Subject: Re: drop into the interpreter  
>To: python-list at python.org
>
>Hoang Do wrote:
>> is there a facility to inspect the run-time of a python script?
>> Essentially, it would execute a script to a set specific
point and then drop
>> into the interpreter.  Something like a "Stop" or "Break"?
>
>Not exactly that, but code.InteractiveConsole comes *very* close.
>
>Regards,
>Martin
>-- 
>http://mail.python.org/mailman/listinfo/python-list


More information about the Python-list mailing list