I can run my python script using
python3 detector.py
however, when I try to run it with systemctl, I get...
Aug 07 04:03:44 raspberrypi systemd[1]: Started Detector.
Aug 07 04:03:45 raspberrypi python3[964]: Traceback (most recent call last):
Aug 07 04:03:45 raspberrypi python3[964]: File "/home/pi/detector.py", line 4, in <module>
Aug 07 04:03:45 raspberrypi python3[964]: from twilio.rest import Client
Aug 07 04:03:45 raspberrypi python3[964]: ModuleNotFoundError: No module named 'twilio'
Aug 07 04:03:45 raspberrypi systemd[1]: detector.service: Main process exited, code=exited, status=1/FAILURE
Aug 07 04:03:45 raspberrypi systemd[1]: detector.service: Failed with result 'exit-code'.
Why would I be able to see the module when I run it manually, but not through the service?
/lib/systemd/system/detector.service
[Unit]
Description=Detector
After=multi-user.target
[Service]
Type=idle
ExecStart=/usr/bin/python3 /home/pi/detector.py > /home/pi/detector.log
[Install]
WantedBy=multi-user.target
When I am in my terminal and I run:
which python3
, I get /usr/bin/python3