kishorviswanathan / ChromePad

Virtual GamePad for Chrome OS
5 stars 1 forks source link

Can't Run Script - Python2/3 errors #5

Open EtherealSerge opened 3 years ago

EtherealSerge commented 3 years ago

Hi not sure if you even still update this project, but I stumbled across it and wanted to give it a shot. However after install, running the script results in errors. From what I can gather the script was supposed to be run in Python 2 but my Chromebook has Python 3. I tried running the script with Python 2 but then it can't access uinput correctly.

I then tried to futurize the script via Python 3, but that only cleaned up the Print function errors. It's now spitting out TypeErrors; seemingly it's an issue between bytes and strings. I've muddled through the script myself trying to fix it but I don't know enough and am stuck.

Any help would be appreciated!

kishorviswanathan commented 2 years ago

Hi @EtherealSerge,

Sorry I don't have a Chromebook now, so this project was kind of abandoned. Now I have updated it to support Python3. Can you please try cloning this branch and install from there ?

Steps:

git clone https://github.com/kishorv06/ChromePad -b python3-migration
cd ChromePad
./install.sh

# Finally
sudo chromepad
sanniweb commented 2 years ago

Hi @kishorv06, i have a problem with this command:

sudo python3 -m pip install python-uinput

after start report me this error:

Collecting python-uinput
  Using cached python-uinput-0.11.2.tar.gz (26 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: python-uinput
  Building wheel for python-uinput (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9ras02xg/python-uinput_6b275fd16f2a4c55966487347aeb17dc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9ras02xg/python-uinput_6b275fd16f2a4c55966487347aeb17dc/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-budci21v
       cwd: /tmp/pip-install-9ras02xg/python-uinput_6b275fd16f2a4c55966487347aeb17dc/
  Complete output (21 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/uinput
  copying src/__init__.py -> build/lib.linux-x86_64-3.9/uinput
  copying src/ev.py -> build/lib.linux-x86_64-3.9/uinput
  running build_ext
  building '_libsuinput' extension
  creating build/temp.linux-x86_64-3.9
  creating build/temp.linux-x86_64-3.9/libsuinput
  creating build/temp.linux-x86_64-3.9/libsuinput/src
  x86_64-cros-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -O3 -Wall -Os -pipe -fuse-ld=gold -march=x86-64 -fPIC -I/usr/local/include/python3.9 -c libsuinput/src/suinput.c -o build/temp.linux-x86_64-3.9/libsuinput/src/suinput.o
  In file included from /usr/local/include/errno.h:28,
                   from libsuinput/src/suinput.c:19:
  /usr/local/include/bits/errno.h:26:11: fatal error: linux/errno.h: No such file or directory
     26 | # include <linux/errno.h>
        |           ^~~~~~~~~~~~~~~
  compilation terminated.
  error: command '/usr/local/bin/x86_64-cros-linux-gnu-gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for python-uinput
  Running setup.py clean for python-uinput
Failed to build python-uinput
Installing collected packages: python-uinput
    Running setup.py install for python-uinput ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9ras02xg/python-uinput_6b275fd16f2a4c55966487347aeb17dc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9ras02xg/python-uinput_6b275fd16f2a4c55966487347aeb17dc/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-8lt625r5/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/python-uinput
         cwd: /tmp/pip-install-9ras02xg/python-uinput_6b275fd16f2a4c55966487347aeb17dc/
    Complete output (23 lines):
    running install
    /usr/local/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    creating build/lib.linux-x86_64-3.9/uinput
    copying src/__init__.py -> build/lib.linux-x86_64-3.9/uinput
    copying src/ev.py -> build/lib.linux-x86_64-3.9/uinput
    running build_ext
    building '_libsuinput' extension
    creating build/temp.linux-x86_64-3.9
    creating build/temp.linux-x86_64-3.9/libsuinput
    creating build/temp.linux-x86_64-3.9/libsuinput/src
    x86_64-cros-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -O3 -Wall -Os -pipe -fuse-ld=gold -march=x86-64 -fPIC -I/usr/local/include/python3.9 -c libsuinput/src/suinput.c -o build/temp.linux-x86_64-3.9/libsuinput/src/suinput.o
    In file included from /usr/local/include/errno.h:28,
                     from libsuinput/src/suinput.c:19:
    /usr/local/include/bits/errno.h:26:11: fatal error: linux/errno.h: No such file or directory
       26 | # include <linux/errno.h>
          |           ^~~~~~~~~~~~~~~
    compilation terminated.
    error: command '/usr/local/bin/x86_64-cros-linux-gnu-gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9ras02xg/python-uinput_6b275fd16f2a4c55966487347aeb17dc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9ras02xg/python-uinput_6b275fd16f2a4c55966487347aeb17dc/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-8lt625r5/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/python-uinput Check the logs for full command output.

Could you help me solve it?

kishorviswanathan commented 2 years ago

Hey @sanniweb,

Which version of Chrome OS are you running and what is the device model ? Also make sure that you are running these commands in the native Chrome OS terminal (crosh) and not in the linux environment provided for development.