I have a python script which I am trying to run at boot using
sudo crontab -e
using the following command
@reboot python /usr/local/sbin/ShutdownJumper.py
the script ShutdownJumper.py begins with:
#!/usr/bin/env python
#note crontab for superuser required a new PATH variable as here https://unix.stackexchange.com/questions/43392#answer-43394
import subprocess
try:
import RPi.GPIO as GPIO
except RuntimeError:
print("Error importing RPi.GPIO! This is probably because you need superuser privileges. You can achieve this by using 'sudo' to run your script")
when I reboot my RPi I get the following email back:
Traceback (most recent call last):
File "/usr/local/sbin/ShutdownJumper.py", line 4, in <module>
import RPi.GPIO as GPIO
ImportError: No module named RPi.GPIO
I've tried changing the PATH in the crontab, so no avail..
pythonpoint to in your system? isRPiinstalled for that interpreter? is the path toRPiin your defaultPYTHONPATH? if not you could setsys.pathto include the path toRPiin your python script.