When calling a python script via SSH, it has different results as compared to running it over GUI.

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

When calling a python script via SSH, it has different results as compared to running it over GUI.

Post by /RaspberryPi »

I made a small program utilising the Sense HAT that, when the joystick is pressed, outputs a color depending on direction.
When I run it through the editor, or via direct executable through the GUI, it runs fine, but when I run it over SSH, it does nothing.
Here's the code I'm using, if that helps:
from sense_hat import SenseHat, ACTION_PRESSED from time import sleep sense = SenseHat() print ("program starting") def pushed_up(event): if event.action == ACTION_PRESSED: print ("YES") sense.load_image("circle.png") sleep(5) sense.clear() def pushed_down(event): if event.action == ACTION_PRESSED: print ("NO") sense.load_image("cross.png") sleep(5) sense.clear() sense.stick.direction_up = pushed_up sense.stick.direction_down = pushed_down This is executed through the command line using the script "python text_scroll.py", because it's an edit of a sample project that I forgot to rename. Idk if I'm executing it wrong, but it doesn't work.
I looked through the subreddit using keywords on what I'm experiencing, but found nothing.
I've just started learning python recently, so any help is appreciated!

submitted by /u/GoodoDarco
[link] [comments]

More...
Post Reply

Return to “Raspberry Pi Forum”