python -i (interactive environment)

Joe JoeSalmeri at hotmail.com
Sun Mar 6 16:04:09 EST 2005


Thanks Michael, that's what I was looking for.

Are there any differences between that and the actual interactve prompt that 
I should be aware of?

Would you consider that a better method than using (thanks to those who 
suggested this other option):

import os
os.environ['PYTHONINSPECT'] = '1'


"Michael Hoffman" <cam.ac.uk at mh391.invalid> wrote in message 
news:d0flpp$clv$1 at gemini.csx.cam.ac.uk...
> 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