I am working with my Raspberry Pi 2 B+ and I am using Raspbian. I have a python script located at /home/pi/Desktop/control/gpio.py
When I type /hom
You will get this error because you do not have the execute
permission on your file. There are two ways to solve it:
python gpio.py
python will load the file by reading it, so you don't need to have execute permission.Granting yourself execute permission. You do this by running chmod u+x yourfile.py
.
However, doing so will not work unless you add a shebang at the top of your python program. It will let your linux know which interpreter it should start. For instance:
#!/usr/bin/env python
This would try to run python
using your current $PATH
settings. If you know which python you want, put it here instead.
#!/usr/bin/python3
Remember the shebang must be the very first line of your program.