How to tell in if python is being invoked interactively?

Alex alex at
Wed Mar 29 23:12:20 CEST 2000

Hi.  I am setting up python for use by potentially a large number of
people.  I would like to set it up so that if it is invoked
interactively, a message telling people how to inform me of problems
is displayed.  But I don't want that message to be displayed if python
is being used to run a program.

Is there some way to tell in whether or not python is
being invoked interactively?  Unfortunately, sys.argv does not seem to
be set when is imported, so I can't do it that way.
For now, I have amended the start up message in the C code, but that
will have to be changed by hand if I ever upgrade python.


More information about the Python-list mailing list