python-uinput icon indicating copy to clipboard operation
python-uinput copied to clipboard

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

Open donaldmunro opened this issue 2 years ago • 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")

donaldmunro avatar May 05 '23 12:05 donaldmunro

https://github.com/selkies-project/python-uinput We accept pull requests.

ehfd avatar Aug 04 '23 10:08 ehfd

@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

rkmax avatar Oct 19 '23 00:10 rkmax

setup.cfg: python-uinput @ git+https://github.com/selkies-project/[email protected]

pip3 install git+https://github.com/selkies-project/[email protected]

@rkmax

ehfd avatar Oct 19 '23 05:10 ehfd

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.

Kuba314 avatar Jan 20 '24 13:01 Kuba314

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

ehfd avatar Jan 20 '24 21:01 ehfd

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

gitanat avatar Feb 18 '24 13:02 gitanat

I'm alive, see my comment: https://github.com/tuomasjjrasanen/python-uinput/issues/49#issuecomment-1951352788

tuomasjjrasanen avatar Feb 18 '24 15:02 tuomasjjrasanen