PyUserInput
                                
                                 PyUserInput copied to clipboard
                                
                                    PyUserInput copied to clipboard
                            
                            
                            
                        PyKeyboard on autostart does not work
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.
Make sure X11 is running before you start the script.
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.
Thanks, now it works :)