[Pythonmac-SIG] Can't run Python scripts from Terminal

Jack Jansen Jack.Jansen@oratrix.com
Sun, 13 Apr 2003 23:31:34 +0200


On zondag, apr 13, 2003, at 22:55 Europe/Amsterdam, Michael Hudson 
wrote:

> Paul Berkowitz <berkowit@silcom.com> writes:
>
>>     [250-166:~/Library/Scripts/Python] berkowit% lunch.py
>>     lunch.py: Command not found.
>
> '.' is not in your $PATH; try ./lunch.py instead.

I _think_ Michael is right, because you say you use out-of-the-box 
Python 2.2,
but just for completeness sake: I had this same thing happening to me 
with Python 2.3
the other day, and I did have . in my path, and it even didn't work 
with a full
pathname.

After much gnashing of teeth and tearing out of hair it turned out that 
my file
had Macintosh line separators. Python 2.3 handles any end-of-line 
convention,
so "python file.py" works fine, but the unix kernel wants only unix end 
of
lines, so the #! line couldn't be interpreted.
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma 
Goldman -