I am working with a systemd service that must start a python script, which is configured with a .ini file. The service looks like this:
[Unit]
Description=service to configure and run python script with config.ini
After=multi-user.target
[Service]
Type=simple
User=root
ExecStart=/home/anaconda3/bin/python ConfigureMe.py '-c /etc/config_file.ini:relevant_section'
[Install]
WantedBy=multi-user.target
The service throws “No Section Error: No section ‘relevant_section’” whenever I ‘sudo systemctl start ConfigureMe.service’. My system runs Ubuntu Server 22.04. The service could not see some required python packages earlier, and using /home/anaconda3/bin/python instead of /usr/bin/python fixed this. 'which python' returned anaconda python. Perhaps this is causing an issue? I am a linux newbie and any help is appreciated!
Things I've tried:
- Checking the .ini file, which is located in /etc, and [relevant_section] is definitely there
- Made a copy of the .ini file and put it in my home directory, told the service to look there. Same error thrown
- Attempted to run the script manually with both .ini file versions. i.e. ‘python ConfigureMe.py -c /path/config_file.ini:relevant_section’ . Configuring with the .ini in /home works, but the one in /etc throws the same No Section Error as before.
- Checked file permissions: home .ini file has -rw-rw-r--, and /etc .ini file has -rwx-r-wr-w.
- Adding 'sudo' in front of the command in ExecStart. Same error thrown for both .ini files.