tuomasjjrasanen/python-uinput

sysconfig.get_config_var("SO") deprecated and removed in python 3.11

donaldmunro opened this issue · 7 comments

sysconfig.get_config_var("SO") is used in init.py:

_libsuinput_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "_libsuinput" + sysconfig.get_config_var("SO")))

but returns None in python 3.11:

python --version
Python 3.11.3

python
Python 3.11.3 (main, Apr  5 2023, 15:52:25) [GCC 12.2.1 20230201] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sysconfig
>>> print(sysconfig.get_config_var("SO"))
None

leading to errors like:

Traceback (most recent call last):
  File "/usr/lib/keyboard-center/main.py", line 8, in <module>
    from mainUi import MainWindow
  File "/usr/lib/keyboard-center/mainUi.py", line 23, in <module>
    from devices.keyboard import SUPPORTED_DEVICES, KeyboardInterface
  File "/usr/lib/keyboard-center/devices/keyboard.py", line 1, in <module>
    import uinput
  File "/usr/lib/python3.11/site-packages/uinput/__init__.py", line 86, in <module>
    _libsuinput_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "_libsuinput" + sysconfig.get_config_var("SO")))
                                                                                     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str

To fix change to

sysconfig.get_config_var("EXT_SUFFIX")
rkmax commented

@ehfd yeah the fix was merged in your fork but version 0.11.3 is not published. could you please provide me instructions of how to install your version instead this one

ehfd commented

setup.cfg: python-uinput @ git+https://github.com/selkies-project/python-uinput.git@0.11.3

pip3 install git+https://github.com/selkies-project/python-uinput.git@0.11.3

@rkmax

Btw I e-mailed the original author of the python-uinput project (this repo's owner) a month ago about this issue and they still haven't replied. What's weird is that the github account seems active.

ehfd commented

We have ultimately abandoned this codebase completely. Use python-evdev.

Merged in https://github.com/pyinput/python-uinput2 (with minor changes)

I'm alive, see my comment: #49 (comment)