REPOST: Re: Finding out that Python is in interactive mode in sitecustomize.py
careye at spamcop.net
Sun Dec 30 03:46:02 EST 2001
joonas at olen.to (Joonas Paalasmaa) writes:
> For some reason it doesn't work in sitecustomize.py .
> When these lines are to sitecustomize.py 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 sitecustomize.py 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 sitecustomize.py:
os.environ['PYTHONSTARTUP'] = '/path/to/interactive_startup.py'
Carey Evans http://home.clear.net.nz/pages/c.evans/
========= WAS CANCELLED BY =======:
From: Carey Evans <careye at spamcop.net>
Subject: cmsg cancel <87k7v5ksdx.fsf at psyche.dnsalias.org>
Control: cancel <87k7v5ksdx.fsf at psyche.dnsalias.org>
Date: Mon, 31 Dec 2001 02:42:05 GMT
Organization: A poorly-installed InterNetNews site
Message-ID: <cancel.87k7v5ksdx.fsf at psyche.dnsalias.org>
X-Trace: news2.kornet.net 1009774308 27193 184.108.40.206 (31 Dec 2001 04:51:48 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 04:51:48 +0000 (UTC)
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