REPOST: Re: Finding out that Python is in interactive mode in

Carey Evans careye at
Sun Dec 30 03:46:02 EST 2001

joonas at (Joonas Paalasmaa) writes:

> For some reason it doesn't work in .
> When these lines are to and Python is started in
> interactive mode, Python prints "In non-interactive mode".


Looking closer, it looks like sys.ps1 is set up just before the
interactive loop is started, but after is imported.

Given this, the easiest solution looks like the PYTHONSTARTUP
environment variable.  The file this points to is only executed for an
interactive session.  You could set this for all users in a global
shell startup file, or just set it from

  import os
  os.environ['PYTHONSTARTUP'] = '/path/to/'

	 Carey Evans

========= WAS CANCELLED BY =======:
From: Carey Evans <careye at>
Newsgroups: comp.lang.python
Subject: cmsg cancel <87k7v5ksdx.fsf at>
Control: cancel <87k7v5ksdx.fsf at>
Date: Mon, 31 Dec 2001 02:42:05 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: <cancel.87k7v5ksdx.fsf at>
X-Trace: 1009774308 27193 (31 Dec 2001 04:51:48 GMT)
X-Complaints-To: usenet at
NNTP-Posting-Date: Mon, 31 Dec 2001 04:51:48 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.

More information about the Python-list mailing list