PYTHONSTARTUP not working on debian?

Bruce Sass bsass at freenet.edmonton.ab.ca
Thu May 24 03:50:18 EDT 2001


On 24 May 2001, David M. Cooke wrote:
> At some point, Bruce Sass <bsass at freenet.edmonton.ab.ca> wrote:
> > It works OK from a text console, or when starting from the commandline
> > of a Konsole session... but not when started from Konsole's File menu.
> > So, there is something in how python gets started that affects if
> > .pythonrc.py is read (guessing, the difference between starting from a
> > shell commandline and doing "exec python").
> >
>
> Probably because when it's run from the file menu, the environment isn't set
> up as you expect it. Here's a short program to test what environment
> it's sending:

<prg snipped>
Thanks.

> In general, if you set some environment variables in your .bashrc or
> .tcshrc, etc., those won't be set if that file isn't run (which it
> usually isn't when starting a X session!)

Ya.  I have the "export" in .bashrc, sourced by .bash_profile.
It is a KDE thing, or maybe an ash vs. bash as sh thing.

Both Konsole's File menu and the K "start" menu are generated from
.desktop files, neither of those methods results in python getting the
environment set in .bashrc; starting python from Konsole's commandline
gets me the rc environment.

> If you use a .xsession file to start up your window manager, I suppose
> you could set PYTHONSTARTUP, etc. there, and it should be set globally
> in your X session.

Not usually.

The situation actually works well for me (different story if I
_needed_ to do something in .pythonrc.py, although not likely since I
have no aversion to `fixing' system files if they `broken').

Typically, I have an Xemacs window, a Konsole window running Python's
(started from the File menu, so the title bar reflects the current
contents of the window), and Konquorer flip-flopping between help
browser and file manager.  No need to automatically setup pydocs
'cause I got the HTML pages.

Little extra bits are nice when running from a tty, and .pythonrc.py
gets read then... works for me.


- Bruce





More information about the Python-list mailing list