Re: executable python scripts

Tim MacKenzie (tym@bruce.cs.monash.edu.au)
22 Mar 1995 04:45:23 GMT

Guido.van.Rossum@cwi.nl wrote:
>> I am running python 1.1.1 under SunOS (soon to be Solaris)
>[...]
>> I then made the following file (called fred),
>>
>> #!/data/maths/graham/APP/PYTHON/bin/python
>> print "a"
>>
>> Now when I run fred by doing say "./fred", I get the message
>> "./fred: Permission denied.".
>
>Some OS'es have a limit of 32 bytes on the pathname used here. Try a
>shorter path... (It may be a symbolic link I think.)

Yes, this is almost certanly the problem. It's not always possible to
make a shorter path so I use the following:

#!/bin/sh

a=''' '
exec python $0 "$@"
'''

This should work for any path. It also has the advantage of you not
having to specify where python is.

You also need to make your file executable: chmod +x fred

-- 
-Tim MacKenzie (tym@dibbler.cs.monash.edu.au)