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

Clarence Gardner clarence at beach.silcom.com
Wed Dec 22 18:26:40 EST 1999


Bernhard Herzog <herzog at online.de> wrote:
: Siggy Brentrup <bsb at winnegan.de> writes:

:> Clarence Gardner <clarence at beach.silcom.com> writes:
:> I did a little more testing and found out that results depend on your
:> PATH setting.
:> 

: Python tries to initialize sys.path based on the location of the python
: executable. If argv[0] contains no '/' python searches $PATH for the
: executable and starts from there.

: On Linux it seems that a program called by the #! mechanism only gets
: the basename of the file in argv[0], i.e. there's no '/' and therefore
: python searches through the directories in $PATH, so it might get the
: wrong one.

: I'm not sure whether this is to be considered a bug in Linux or Python,
: but Python could perhaps work around this on a Linux system by using
: /proc/self/exe (which is a symbolic link to the executable of the
: process) as reference when it searches $PATH for the file.

: -- 
: Bernhard Herzog	  | Sketch, a drawing program for Unix
: herzog at online.de  | http://sketch.sourceforge.net/

Thank you!  I'm much less confused now.  Bad Linux; bad!
-- 
Clarence Gardner
Software Engineer
NetLojix Communications    NASDAQ:NETX
clarence at netlojix.com



More information about the Python-list mailing list