In article <[EMAIL PROTECTED]>,
 Steve Holden <[EMAIL PROTECTED]> wrote:

> Michael Hoffman wrote:
> > 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.
> 
> Unfortunately it does so in an entirely new namespace, thereby losing 
> the advantage of -i - namely, that you can investigate the program's 
> namespace after it's terminated.

code.interact() has a namespace argument ('local'), so it really easy to 
have it use the namespace you want.

Just
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to