OSError: [Errno 2] No such file or directory ( AFTER reboot of Linux :( )

Asked by DougyDoug

Hello,

first, thanks for this uinput package. It works fine. Unfortunately, it doesn't anymore once I reboot the linux system. :(

Before the reboot, I have installed the package and tried it, and my python script loaded it and executed my code.

After the reboot when I install the package again, and use the command-line to execute my script, it works again...until the next reboot.

This is what I did, step-by-step:

1. in command-line, I typed the following (according to a tutorial):

sudo modprobe uinput
git clone https://github.com/tuomasjjrasanen/python-uinput
cd python-uinput
sudo python setup.py install --prefix=/usr/local

2. Received these for git clone:

Cloning into 'python-uinput'...
remote: Reusing existing pack: 993, done.
remote: Total 993 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (993/993), 235.38 KiB | 138 KiB/s, done.
Resolving deltas: 100% (422/422), done.

Aaaaaaaand this for setup-py install:

running install
running build
running build_py
creating build
creating build/lib.linux-armv6l-2.7
creating build/lib.linux-armv6l-2.7/uinput
copying src/__init__.py -> build/lib.linux-armv6l-2.7/uinput
copying src/ev.py -> build/lib.linux-armv6l-2.7/uinput
running build_ext
building '_libsuinput' extension
creating build/temp.linux-armv6l-2.7
creating build/temp.linux-armv6l-2.7/libsuinput
creating build/temp.linux-armv6l-2.7/libsuinput/src
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c libsuinput/src/suinput.c -o build/temp.linux-armv6l-2.7/libsuinput/src/suinput.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-armv6l-2.7/libsuinput/src/suinput.o -l:libudev.so.0 -o build/lib.linux-armv6l-2.7/_libsuinput.so
running install_lib
copying build/lib.linux-armv6l-2.7/uinput/__init__.py -> /usr/local/lib/python2.7/dist-packages/uinput
copying build/lib.linux-armv6l-2.7/uinput/ev.py -> /usr/local/lib/python2.7/dist-packages/uinput
copying build/lib.linux-armv6l-2.7/_libsuinput.so -> /usr/local/lib/python2.7/dist-packages
byte-compiling /usr/local/lib/python2.7/dist-packages/uinput/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/uinput/ev.py to ev.pyc
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/python_uinput-0.10.1-py2.7.egg-info
Writing /usr/local/lib/python2.7/dist-packages/python_uinput-0.10.1-py2.7.egg-info

3. Jumped to /home/pi/pinball/ and typed "sudo python wizard.py" and it worked.

4. Typen "sudo nano /etc/rc.local" and edited the file, by adding BEFORE the "exit 0" :

cd /home/pi/pinball/
sudo python ./wizard.py >/tmp/script.out 2>&1

5. "sudo reboot"

6. This is what /tmp/script.out contains:

Traceback (most recent call last):
  File "./wizard.py", line 13, in <module>
    device = uinput.Device([uinput.KEY_LEFTSHIFT, uinput.KEY_RIGHTSHIFT, uinput.KEY_A])
  File "/usr/local/lib/python2.7/dist-packages/uinput/__init__.py", line 161, in __init__
    self.__uinput_fd = _libsuinput.suinput_open()
  File "/usr/local/lib/python2.7/dist-packages/uinput/__init__.py", line 64, in _error_handler
    raise OSError(code, os.strerror(code))
OSError: [Errno 2] No such file or directory

Even if I type "sudo python wizard.py" the same lines show up on screen.

I have no clue what I should do now.

Question information

Language:
English Edit question
Status:
Solved
For:
python-uinput Edit question
Assignee:
No assignee Edit question
Solved by:
DougyDoug
Solved:
Last query:
Last reply:
Revision history for this message
DougyDoug (ercankoese) said :
#1

Fixed it, I had to use "sudo sh -c 'echo uinput >> /etc/modules'" in command line.