PYTHONSTARTUP not working on debian?

Bruce Sass bsass at freenet.edmonton.ab.ca
Wed May 23 23:28:10 EDT 2001


On Wed, 23 May 2001, Rainy wrote:

> I'm running debian unstable, python 1.5, 2.0 and 2.1(compiled),
> and PYTHONSTARTUP is set to ~/.pythonrc.py, which contains
> line import time. When I start interactive session, and try
> time.time() for example, it gives me a name error, as if
> time isn't imported. What's wrong?

Same setup here, ~/.pythonrc.py looks like this:

---
print "importing os, sys..."
import os, sys

if sys.version[:3] == '2.1':
    print "importing pydoc.help..."
    from pydoc import help
---

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").


- Bruce





More information about the Python-list mailing list