PyUserInput icon indicating copy to clipboard operation
PyUserInput copied to clipboard

PyKeyboard on autostart does not work

Open Werner91 opened this issue 8 years ago • 3 comments

Hi,

I'm using PyKeyboard in two of my three python scripts. All three scripts run in a while loop. The script without PyKeyboard runs how it should. But the other two scripts are not running when I boot my Pi. The scripts are execute able. When I run them manually everything works fine.

I added

exec 2> /tmp/rc.local.debug
set -x" 

into

/etc/rc.local

to check whats the issue. I found out there must be a problem with the line:

....
"k=PyKeyboard()"
...

So do I have to autostart something for PyUserInput befor I start the Script wich uses it? Sorry I'm new to Linux and Python.

Thanks.

Werner91 avatar Apr 13 '16 20:04 Werner91

Make sure X11 is running before you start the script.

pepijndevos avatar Apr 13 '16 20:04 pepijndevos

PyUserInput on Linux requires an active X session. X is the application on most Linux systems that is responsible for managing the display, and mouse and keyboard input.

When you have logged in to the environment---I assume you use a graphical desktop environment---the X server will be running, but when /etc/rc.local is loaded, it is not.

A solution would be to start your script as an autostart application. How to do this depends on your desktop environment.

moses-palmer avatar Apr 13 '16 20:04 moses-palmer

Thanks, now it works :)

Werner91 avatar Apr 15 '16 11:04 Werner91