Finding out that Python is in interactive mode in

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

Joonas Paalasmaa <joonas at> writes:

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

A search on for "python test interactive"
comes up with this as the second result:

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

	 Carey Evans

More information about the Python-list mailing list