Coming from Perl

Amer Neely perl4hire at softouch.on.ca
Sat Sep 15 09:39:12 EDT 2007


Bryan Olson wrote:
> Amer Neely wrote:
>> This seems to indicate that maybe my host needs to configure Apache to 
>> run python scripts? But I didn't need to do anything with mine.
> 
> Another possibility: If it works on Windows but not Unix, check
> the end-of-line characters. Windows ends each line with the two
> character sequence carriage-return + newline, which in Python
> is "\r\n". Unix uses newline alone, "\n".
> 
> Most Unixies will choke on a #! line with a carriage return.
> The Python interpreter will accept source files with either
> end-of-line on either system, but of course you'll not get
> that far unless the operating system respects the shebang line.
> 
> Maybe you already checked that. Hmmm...other possiblities...
> 
> Do you have shell access? Can you executing it directly from
> the shell? Do you get a Python error, or some other?
> 
> Did you:  chmod ugo+rx <yourscript>
> 
> Is Python in /usr/bin? What does "which python" say?
> 
> Generally, most experts seem to prefer:
> 
>     #!/usr/bin/env python
> 
> You might try changing the the extension of your script from .py
> to .cgi. Windows uses the .py to choose the executable, but Unix
> does not care; it used the shebang line.
> 
> 

Hmmm. These are interesting suggestions. Especially in light of a new 
wrinkle pointed out by [IV]. That being the script runs fine under my 
Apache at home with no special modules loaded.

I don't have shell access but I can run 'which python' from a Perl 
script, and I will try the different shebang line you suggested.

Thanks for the suggestions.

-- 
Amer Neely
w: www.webmechanic.softouch.on.ca/
Perl | MySQL programming for all data entry forms.
"Others make web sites. We make web sites work!"



More information about the Python-list mailing list