0

I want to interact with the GUI of my display(Open an image every time I press a button that I have interfaced via GPIO) via a python script which is executed after bootup. (I have edited crontab file to execute a shell script which in turn executes the python file).

However, the image does not open. Python logs say: "Error: no "view" rule for type "image/png" passed its test case"

Note: The program works perfectly fine when I execute the shell file manually. The problem occurs only when the script is executed via crontab

What can be the possible cause for this?

2
  • All my Pi's are headless, so I can't test it; but I've noticed similar on my Linux desktop. Your scenario does not work because the cron script does not have access to your GUI. You might get it to work if you include export DISPLAY=0:0 (or something similar) in your shell script - to point to the GUI. Better would be to start your Python script from the GUI - there may be a way to do this automatically at log-on time. If you want further help, include details of your OS and desktop manager.
    – Peter Bill
    Commented Apr 16 at 15:14
  • The $DISPLAY variable should be set to :0.0. See askubuntu.com/a/432257 for details .
    – Peter Bill
    Commented Apr 16 at 16:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.