i wrote a py script to fetch page from web,it just read write permission enough,so my question is when we need execute permission?
A:
If you want to be able to run it directly with $ file.py
then you'll need the execute bit set. Otherwise you can run it with $ python file.py
.
Daniel Roseman
2010-09-29 14:03:37
+4
A:
Read/write is enough if you want to run it by typing python file.py
. If you want to run it directly as if it were a compiled program, e.g. ./file.py
, then you need execute permission (and the appropriate hash-bang line at the top).
Michael E
2010-09-29 14:03:44
+2
A:
It's required to do so if you need to run the script in this way: ./file.py
. Keep in mind though, you need to put the path of python at the very top of the script: #!/usr/bin/python
.
But wait, you need to make sure you have the proper path, to do that execute: which python
.
Ruel
2010-09-29 14:10:19
i'm under ubuntu lucid 10.04,use komodo edit,when i create a py file,it will give a shebang like,#!/usr/bin/env pythonis there sth different with #!/usr/bin/python what's common way?
mlzboy
2010-09-30 02:32:46
See [this question](http://stackoverflow.com/questions/2429511/why-do-people-write-usr-bin-env-python-on-the-first-line-of-a-python-script). `#!/usr/bin/env python` is more common.
ma3
2010-09-30 02:52:13