Locate python home

Peter Maas fpetermaas at netscape.net
Wed Feb 25 09:43:45 EST 2004


Mike C. Fletcher wrote:
> Thomas Aanensen wrote:
> Never trust the assumption:
> 
>  >>> import os
>  >>> os.path.isfile( os.path.join(os.path.dirname( sys.executable ), 
> 'python.exe' ))
> False

If Thomas wants to find the console version he should start a
console script: python checkpath.py (assuming python is in the
PATH). sys.executable delivers always the executable that executes
the script. If python is not in the PATH there's no safe way to
find python.exe as far as I know.

Mit freundlichen Gruessen,

Peter Maas

-- 
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24
Tel +49-241-93878-0 Fax +49-241-93878-20 eMail peter.maas at mplusr.de
-------------------------------------------------------------------



More information about the Python-list mailing list