469,915 Members | 2,635 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,915 developers. It's quick & easy.

Python execution problem

Using OSX 10.4.5

This is more of a unix/tcsh question than a python question.
Somehow I got to the point where I have two files 'a.py' and 'b.py'
which have identical contents and permissions, but one refuses to
execute:

[blah:/Library/WebServer/CGI-Executables] me% a.py
tcsh: a.py: Command not found.
[blah:/Library/WebServer/CGI-Executables] me% b.py
okay
[blah:/Library/WebServer/CGI-Executables] me%

Could someone enlighten me about how the shell knows to execute a
script? I always assumed it was just the extension, but this seems to
prove me wrong.

tnx>mp

Mar 18 '06 #1
1 1040
ma*********@email.com wrote:
Using OSX 10.4.5

This is more of a unix/tcsh question than a python question.
Somehow I got to the point where I have two files 'a.py' and 'b.py'
which have identical contents and permissions, but one refuses to
execute:

[blah:/Library/WebServer/CGI-Executables] me% a.py
tcsh: a.py: Command not found.
[blah:/Library/WebServer/CGI-Executables] me% b.py
okay
[blah:/Library/WebServer/CGI-Executables] me%

Could someone enlighten me about how the shell knows to execute a
script? I always assumed it was just the extension, but this seems to
prove me wrong.


It checks each directory in your path for an executable file with the
name you specified. Each file has a set of associated bits to tell
whether it is executable (or readable or writable), and by whom. To add
execute permission to a.py, try this:

chmod +x a.py

FYI, it's not a great idea to rely on the current directory (.) being in
your path. You might want to type it explicitly, e.g ./a.py instead of
a.py.
Mar 18 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Catalin | last post: by
2 posts views Thread by satish | last post: by
28 posts views Thread by Maboroshi | last post: by
68 posts views Thread by Lad | last post: by
118 posts views Thread by 63q2o4i02 | last post: by
10 posts views Thread by sandipm | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.