I have written a python script that displays the image from the URL.

def image_func(link_image):
    img_cmd = "feh -F %s" %(link_image)
    os.system(img_cmd)
    os.system("pkill feh")

If I run the python program directly using

python main.py

it runs without any issue.

But if I run from the .service file .. it throws this error.

feh ERROR: You have no HOME, cannot read themes

I am running this from the root terminal rather than the user terminal.

.service file

[Unit]
Description=My device boot script service
After=multi-user.target

[Service]
Type=idle
user=fa
Environment=DISPLAY=:0
Restart=always
ExecStart=/root/MediaPlayer/venv/Include/start.sh > /dev/null

[Install]
WantedBy=multi-user.target

migrated from meta.askubuntu.com Aug 29 at 8:15

This question came from our discussion, support, and feature requests site for Ubuntu users and developers.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.