Need help: startx to run Python script on local display, but via ssh

The Raspberry Pi is a series of credit card-sized single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and developing countries.

Post Reply
User avatar
/RaspberryPi
Corporate
Posts: 2449
Joined: Wed Jun 05, 2019 1:29 am

Need help: startx to run Python script on local display, but via ssh

Post by /RaspberryPi »

I have a small project that involves a Raspberry Pi with the official touchscreen and a simple PyQt5 script. The script runs fine when I run startx via LXTerminal within the GUI.
Sometimes I want to make some changes to the script. I can edit it locally and reupload it via scp. I can ssh into the device to kill the running script (or just use the Exit button in the PyQt5 GUI). The trick is restarting the script via ssh, which I'd rather do than having to drag out a keyboard and connect it to the RPi just to run this one command.
Running startx python my_script.py via ssh yields this error:
parse_vt_settings: Cannot open /dev/tty0 (Permission denied) I presume that startx is trying to connect the script to an Xwindows-based window that is associated with the login / terminal instance, which, of course, isn't possible through an ssh session. I can't seem to find a way to ask startx to create the window in the currently running Xwindows session on the local display instead.
Yes, I looked carefully at man startx and didn't find any options that might address this situation. I also Googled for an answer and found lots of people asking similar questions, but what they wanted was different, such as running an Xwindows session on the ssh client instead of the device.
Any ideas? Thanks.

submitted by /u/ee-throwaway
[link] [comments]

More...
Post Reply

Return to “Raspberry Pi Forum”