Hot to get Python executable's path ??

vivek kumar gupt_vive at hotmail.com
Sat Jun 14 06:13:48 EDT 2003


>On Saturday 14 June 2003 03:38 am, vivek kumar wrote:
> > Hi all,
> >
> >   I am writing a CGI app. I was trying to find out a way to change the 
>#!
> > line in the CGI scripts for different platforms using an install script.

<snip>

> > TIA and Kind Regards
> > Vivek Kumar
>
>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 ??

Regards
Vivek Kumar

_________________________________________________________________
They're big & powerful. The macho mean machines! 
http://server1.msn.co.in/features/suv/index.asp  SUVs are here to stay!






More information about the Python-list mailing list