I want to run a python pyQt script in crontab. Generally I put this in the crontab -e:
@reboot XAUTHORITY=/home/user/.Xauthority DISPLAY=:0 && sleep 10 && /home/user/miniforge3/envs/slowcontrol/bin/python /home/user/myscripts.py
But the error log shows like this
qt.qpa.xcb: could not connect to display:0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, webgl, xcb.
I googled several suggestions but it didn't help unfortunately:(
like reinstall the xcblib,
change DISPLAY=:0
into export DISPLAY=:0 &&
.
Also I checked the DISPLAY env by env | grep DISPLAY
and it is DISPLAY=:0
I really don't have any clue where was wrong. And I am in Scientific Linux 7 which should be similar to either Red Hat or Centos 7.
And of course that code can be run in terminal without any problem.
I really appreciate if you could give any suggestions.