I'm trying to run a Python script as a service using systemctl on a Raspberry Pi Zero running Raspbian GNU/Linux 10 (buster). My service file looks like this:
[Unit]
Description=pi_sensor
After=network.target
[Service]
ExecStart=/usr/bin/python3 /home/pi/Documents/pi_sensor/python/read_sensor_data.py -p /home/pi/Documents/pi_sensor/url/marley_1.tsv
Restart=always
User=pi
[Install]
WantedBy=multi-user.target
However, whenever the script runs the "-p" argument is ignored (e.g. if I print the argument I get "none"). If I run this exact script from a shell it works fine. It also works through systemctl if I hard code the argument into the Python script. Because of this, I think I'm messing up the systemd argument syntax for adding arguments to Python scripts. I also tried putting the file path after -p in single quotes, which didn't work. Thanks for your help!