I'm a definite Python newbie, so the answer here may be obvious. But I'm trying to change a simple .py file's permissions so it can be run directly from the Terminal window (I'm running Python3 from a Macbook). I've entered the shebang line #! /usr/bin/env python3 at the top of my script, but according to the tutorial I'm following, I next need to run the following command:
chmod +x pythonScript.py
But every time I try running this either from Terminal or the Python shell, I get the following syntax error:
>>> chmod +x pythonScript.py
File "<stdin>", line 1
chmod +x pythonScript.py
^
SyntaxError: invalid syntax
Any ideas on what I'm missing? How do I change the file permission so I can execute a file directly from the Terminal window?
You probably already figured it out but just in case there are others with a similar question.
name.py.chmod +x name.py../name.pyonly use pythonScript.py if that is the name of your .py file
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