What causes the below error?
-bash: ./proj.py: Permission denied
I have one file, called projsol.py
, that runs perfectly out of terminal when I enter ./projsol.py --summary *.html
in Terminal.
However, when I enter ./proj.py --summary *.html
, I get the above error. I've literally copied and pasted the entire context of projsol.py
into proj.py
, tried running the command again, and it still gives me the above bash error. What's causing this?
Note: I am very new to programming, and have very unfamiliar with Terminal and Python, so please explain in layman's terms (it's much appreciated!).
Permission denied simply means the system is not having permission to write the file to that folder. Give permissions to the folder using "sudo chmod 777 " from terminal and try to run it.
Usually, you get the error bash permission denied when running some script/file that does not have execute permissions. It is one of the most common Magento errors. All you need to do to fix it is to change file permissions and add executive one.
Unlike a CGI script, Python scripts do not need to have execute permissions to run when you invoke them with the python command. Python is an interpreted language, which means that if you call the file with python [filename], Python itself handles the execution.
Run the chmod command against the file in the following manner:
sudo chmod +x proj.py
This assigns the executable bit to the file.
If that doesn't work run the following command, from the same directory as proj.py, and provide the output
ls -al
This will give you a dump of the directory as well as permissions and user/group permissions on the file. Something is not set correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With