Activating `-i' from inside a script?

Bob Gailer bgailer at
Fri Jun 27 17:07:57 CEST 2003

At 08:24 PM 6/26/2003 -0400, François Pinard wrote:

>Hi, Python friends.
>Is there a way for a script to activate the effect of the `-i' option, that
>is, to force interactive mode once `__main__' has run?  For one application,
>I would like that if the application discovers some data discrepancy or
>failure (not a Python error) and only then, and if the application was also
>started from a tty, it gives the user to interactively explore, using
>Python, the context that was built while the run was going.

You can use sys.exit() within __main__ to terminate the interpreter if 
there is no problem, and use -i to run the module.

Bob Gailer
bgailer at
303 442 2625
-------------- next part --------------

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
Version: 6.0.492 / Virus Database: 291 - Release Date: 6/24/2003

More information about the Python-list mailing list