I have a python3 script, intended to run at boot using rc.local. The script is for multimedia purposes, uses omxplayer and GPIO pins.

Im using WaveShare 7In HDMI LCD as the display, with the Raspberry pi 3 model B. It has touch functionality which I need to disable, for that Im using the shell command:

subprocess.check_call("xinput disable 6", shell=True)

'6' is device ID num - the Waveshare touch display; Which works fine as long as I run the script directly from the interpreter or the terminal. The issue raises when I run the script automatically at boot using rc.local file, and even occasionally when I run it manually from teminal/command line. Check_call throws exception CalledProcessError, with the traceback message: unable to connect to x server

I had tried to append DISPLAY=:0.0 to the command, but with no success. As well as importing xinput module with operate_xinput_device() instead of using shell command.

Kernel: Linux raspberrypi 4.9.59-v7+

Who had this issue before or knows how to solve it, I would love to get some help.

Thanks! Eli

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.