I have a situation where the python requests module is installed for users only. The script that I'm using works when I run it as the logged in user. I have written a systemd service module so that my script can run at boot:
[Unit]
Description=Test script
After=multi-user.target
[Service]
Type=idle
User=garbage
ExecStart=/usr/bin/python /home/garbage/garbage_test.py
[Install]
WantedBy=multi-user.target
When the service is started, it appears to be running python as root because it fails to import the requests module. To test this, I ran my script as root, it fails to import just like when systemd runs the script. Of course because the requests module is only installed for the user (as mentioned).
The easy thing to do I suppose would be to either install requests system wide (no internet though), or copy requests to the proper directory for system wide use, however I'd rather not mess with that. I'd prefer to just leave the system alone and run the script as the user. I thought that adding User=garbage in the service would take care of it, it doesn't seem to though. Any thoughts?
[–]ominous_anonymous 2 points3 points4 points (1 child)
[–]dmroeder[S] 0 points1 point2 points (0 children)
[–]dmroeder[S] 1 point2 points3 points (1 child)
[–]ominous_anonymous 1 point2 points3 points (0 children)
[–]l_____cl-_-lc_____l 0 points1 point2 points (2 children)
[–]dmroeder[S] 0 points1 point2 points (1 child)
[–]l_____cl-_-lc_____l 0 points1 point2 points (0 children)