Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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).

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top