Detecting -i in a script

Chris Rebert clp2 at rebertia.com
Mon Apr 13 15:19:01 EDT 2009


On Mon, Apr 13, 2009 at 12:09 PM, Marek Szuba <marecki at fake.address> wrote:
> Hello there,
>
> Is there any way of detecting in a script whether the interpreter
> session running it has been launched with the -i option? My Google fu
> has failed me on this subject... Thanks in advance.

The sys.flags.interactive bool.

Details: http://docs.python.org/library/sys.html#sys.flags

Cheers,
Chris

-- 
I have a blog:
http://blog.rebertia.com



More information about the Python-list mailing list