Finding out that Python is in interactive mode in sitecustomize.py

Carey Evans careye at spamcop.net
Fri Dec 28 01:09:31 CET 2001


Joonas Paalasmaa <joonas at olen.to> writes:

> How can I find out that Python is started in interactive mode in
> sitecustomize.py ?

A search on http://groups.google.com/ for "python test interactive"
comes up with this as the second result:

    import sys
    if hasattr(sys, "ps1"):
        # probably interactive
    else:
        # probably not interactive

-- 
	 Carey Evans  http://home.clear.net.nz/pages/c.evans/



More information about the Python-list mailing list