python -i (interactive environment)

Michael Hoffman cam.ac.uk at mh391.invalid
Sun Mar 6 14:31:03 EST 2005


Joe wrote:

> I want the script to decide whether to fall back to the interactive prompt. 
> You solution makes it ALWAYS fall back to the interactive prompt.

Actually, using sys.exit() means the program can exit even if python -i
is used.

You can use:

import code
code.interact()

which emulates the interactive prompt.
-- 
Michael Hoffman



More information about the Python-list mailing list