I have a python file to update an A-Record on my CPanel web host. It imports a module named
cpanelapi which is located in the same directory as the
When I execute
ddns.py from the command line
/usr/bin/python ddns.py it runs correctly with no errors. However when run from systemd or crontab it fails with
ImportError: No module named cpanelapi.
This is the systemd file:
[Unit] Description=Update A-Record AssertPathExists=/home/ethan/cpanel-ddns-client After=network.target [Service] Type=simple User=ethan WorkingDirectory=/home/ethan/cpanel-ddns-client ExecStart=/usr/bin/python /home/ethan/cpanel-ddns-client/ddns.py [Install] WantedBy=multi-user.target
The script is located at
cpanel-ddns-client/ddns.py and the module is located at
I have tried adding the
cpanel-ddns-client folder to
sys.path which did not work.