Bug in python startup on linux? [Was: Wrong Executable? or something]

Siggy Brentrup bsb at winnegan.de
Tue Dec 21 07:44:59 EST 1999


Clarence Gardner <clarence at beach.silcom.com> writes:

> This is a problem I've seen on many linux systems.  They're all RedHat or
> Mandrake (extended RedHat).

Same holds for Debian slink aka 2.1

I did a little more testing and found out that results depend on your
PATH setting.

Calling scripts with an empty PATH gives the expected results

$ echo $PATH
/home/bsb/bin:/usr/local/X11R6/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/games

$ ~/prj/quicky/py1.5.1.py
1.5.1 (#1, Dec 17 1998, 20:58:15)  [GCC 2.7.2.3]
sys.prefix =  /usr/local
sys.exec_prefix =  /usr/local
sys.path =  ['/home/bsb/prj/quicky', '/usr/local/lib/python1.5/', '/usr/local/lib/python1.5/plat-linux2', '/usr/local/lib/python1.5/lib-tk', '/usr/local/lib/python1.5/lib-dynload', '/usr/local/lib/python1.5/site-packages', '/usr/local/lib/site-python']
PYTHONPATH = * NOT SET *

$ PATH= ~/prj/quicky/py1.5.1.py
1.5.1 (#1, Dec 17 1998, 20:58:15)  [GCC 2.7.2.3]
sys.prefix =  /usr
sys.exec_prefix =  /usr
sys.path =  ['/home/bsb/prj/quicky', '/usr/lib/python1.5/', '/usr/lib/python1.5/plat-linux2', '/usr/lib/python1.5/lib-tk', '/usr/lib/python1.5/lib-dynload', '/usr/local/lib/python1.5/site-packages', '/usr/local/lib/site-python', '/usr/lib/python1.5/site-packages', '/usr/lib/python1.5/site-packages/Bobo', '/usr/lib/python1.5/site-packages/HTMLgen', '/usr/lib/python1.5/site-packages/PIL', '/usr/lib/python1.5/site-packages/graphics', '/usr/lib/python1.5/site-packages/Numerical', '/usr/lib/site-python']
PYTHONPATH = * NOT SET *

$ PATH= ~/prj/quicky/py1.5.2+.py
1.5.2+ (#4, Nov 18 1999, 01:39:08)  [GCC egcs-2.91.66 19990314 (egcs-1.1.2 release)]
sys.prefix =  /usr/local
sys.exec_prefix =  /usr/local
sys.path =  ['/home/bsb/prj/quicky', '/usr/local/lib/python1.5/', '/usr/local/lib/python1.5/plat-linux2', '/usr/local/lib/python1.5/lib-tk', '/usr/local/lib/python1.5/lib-dynload', '/usr/local/lib/python1.5/site-packages', '/usr/local/lib/site-python']
PYTHONPATH = * NOT SET *

$ cat ~/prj/quicky/py1.5.1.py
#! /usr/bin/python

import sys, os

print sys.version
print "sys.prefix = ", sys.prefix
print "sys.exec_prefix = ", sys.exec_prefix
print "sys.path = ", sys.path

print "PYTHONPATH =",
try:
    print os.environ['PYTHONPATH']
except KeyError:
    print '* NOT SET *'

$ diff -u ~/prj/quicky/py1.5.1.py ~/prj/quicky/py1.5.2+.py
--- /home/bsb/prj/quicky/py1.5.1.py	Tue Dec 21 13:26:17 1999
+++ /home/bsb/prj/quicky/py1.5.2+.py	Tue Dec 21 13:25:33 1999
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/local/bin/python
 
 import sys, os
 

I suspect a bug in the python startup routine, since sys.prefix
and sys.exec_prefix are determined at configuration time.

Siggy

-- 
Siggy Brentrup - bsb at winnegan.de - http://www.winnegan.de/
****** ceterum censeo javascriptum esse restrictam *******




More information about the Python-list mailing list