Hot to get Python executable's path ??

Zac Jensen listbox at cybereal.org
Sat Jun 14 12:41:50 CEST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Saturday 14 June 2003 04:13 am, vivek kumar wrote:
> >
> >The shebang only works on unix variant systems.  Windows simply ignores it
> >and
> >goes by the filename extension instead.
>
> Hmm.., but on My windows 2k system I am using Apache and if I try to run
> script as CGI script without giving the shebang line it simply gives me
>
>    500 Internal Server Error
>
> with error
> [Sat Jun 14 15:38:44 2003] [error] [client 127.0.0.1] C:/Program
> Files/Apache Group/Apache2/htdocs/fireshop/environ.py is not executable;
> ensure interpreted scripts have "#!" first line
> [Sat Jun 14 15:38:44 2003] [error] [client 127.0.0.1] (9)Bad file
> descriptor: don't know how to spawn child process: C:/Program Files/Apache
> Group/Apache2/htdocs/fireshop/environ.py
>
>
> Anyway , I recently find out the solution. I tried
>
>    sys.executable
>
> and it works on both windows and linux. So I think I can use it safely to
> substitute the shebang line. Am I right ??

Should be fine, that's odd that apache is honoring the shebang hack in win32, 
but, good I suppose.

sys.executable or equiv. should work fine if you're just checking it during 
install.

- -Zac
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE+6vvuV3L7YsSif1URAhZUAJ4mPgUllyGRArjHNLnKn4/qFDbKqgCdHpyF
f6NwVrkqGAFmwj6jl8aSBSo=
=QTbE
-----END PGP SIGNATURE-----






More information about the Python-list mailing list