Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ecodes misses UInput Constants #238

Open
antheas opened this issue Feb 20, 2025 · 12 comments
Open

ecodes misses UInput Constants #238

antheas opened this issue Feb 20, 2025 · 12 comments

Comments

@antheas
Copy link

antheas commented Feb 20, 2025

My software now has errors such as the following:

<class 'AttributeError'>: module 'evdev.ecodes' has no attribute 'UI_FF_UPLOAD'

IE uinput constants are missing

python-evdev 1.9 got pushed to fedora and arch so I am currently rushing for a mitigation

I also get squiglies everywhere in VS Code now:

Image

So, what am I to do with this?

@antheas
Copy link
Author

antheas commented Feb 20, 2025

latter part is dupe of #236

@antheas
Copy link
Author

antheas commented Feb 20, 2025

It's probably due to using an ancient kernel to build the wheels

@antheas
Copy link
Author

antheas commented Feb 20, 2025

Botch complete:

    try:
        # .ecodes misses UInput stuff, grab from runtime if it exists
        import evdev.ecodes_runtime as ecodes_runtime

        return cast(int, getattr(ecodes_runtime, b))
    except Exception:
        pass

    return cast(int, getattr(evdev.ecodes, b))

@sezanzeb
Copy link
Collaborator

Hi, sorry, what do you mean with

latter part is dupe of #236

and

Botch complete:

?

@antheas
Copy link
Author

antheas commented Feb 20, 2025

I made a fix for my package. But currently evdev.ecodes is missing uinput attrs on arch, fedora, and the wheel

@antheas
Copy link
Author

antheas commented Feb 20, 2025

latter part is dupe of #236

Squiggles on VS code are due to the same issue as that one

@sezanzeb
Copy link
Collaborator

latter part is dupe of #236

Squiggles on VS code are due to the same issue as that one

So you are getting something like

compatibility_device.py:4: error: Module "evdev" does not explicitly export attribute "InputDevice"  [attr-defined]

?

Didn't #236 fix that?

@antheas
Copy link
Author

antheas commented Feb 20, 2025

I did not test master. Hopefully it does (seems that it will). However, the issue is cosmetic and I can live with it for now.

The uinput issue caused a breakage and i had to push an emergency update

@sezanzeb
Copy link
Collaborator

Ah ok.

I can confirm that UI_FF_UPLOAD is missing on my machine:

>>> from evdev.ecodes import UI_FF_UPLOAD
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'UI_FF_UPLOAD' from 'evdev.ecodes' (/usr/local/lib/python3.12/dist-packages/evdev/ecodes.py)
>>> from evdev.ecodes import KEY_A
>>> 

And it seems commit 61beda7 broke it.

Works on 3ff9816:

➜  python-evdev git:(3ff9816) ✗ python3 -c "from evdev.ecodes import UI_FF_UPLOAD"

Breaks after checking out to 61beda7:

➜  python-evdev git:(3ff9816) ✗ git checkout 61beda72e7b101e270f914d5f1d633730e60d083
Previous HEAD position was 3ff9816 Fix ecodes.c generation
HEAD is now at 61beda7 Move from flat-layout to src-layout
➜  python-evdev git:(61beda7) ✗ sudo pip install . --break-system-packages
DEPRECATION: Loading egg at /usr/local/lib/python3.12/dist-packages/evdev-1.8.0-py3.12-linux-x86_64.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation. Discussion can be found at https://github.com/pypa/pip/issues/12330
Processing /mnt/data/Code/python-evdev
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: evdev
  Building wheel for evdev (pyproject.toml) ... done
  Created wheel for evdev: filename=evdev-1.8.0-cp312-cp312-linux_x86_64.whl size=114272 sha256=edeed36af7715cb8417685de073b8d05176f7c48da06cdb12cbdaa68fc460bb8
  Stored in directory: /root/.cache/pip/wheels/2e/97/d6/f9226942d8cb19f6194457f5d4583aef9b6f42fc1f2de7c7fb
Successfully built evdev
Installing collected packages: evdev
  Attempting uninstall: evdev
    Found existing installation: evdev 1.8.0
    Uninstalling evdev-1.8.0:
      Successfully uninstalled evdev-1.8.0
Successfully installed evdev-1.8.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
➜  python-evdev git:(61beda7) ✗ python3 -c "from evdev.ecodes import UI_FF_UPLOAD"   
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: cannot import name 'UI_FF_UPLOAD' from 'evdev.ecodes' (/usr/local/lib/python3.12/dist-packages/evdev/ecodes.py)
➜  python-evdev git:(61beda7) ✗ 

@sezanzeb
Copy link
Collaborator

sezanzeb commented Feb 21, 2025

No, it was 4ca0a8b, sorry, I accidentally imported the root-level evdev folder that didn't exist anymore from 61beda7, which made it work again.

@gvalkov
Copy link
Owner

gvalkov commented Feb 22, 2025

Fixed in a98b68f. I'll make a release this weekend.

@gvalkov
Copy link
Owner

gvalkov commented Feb 23, 2025

Release 1.9.1 is out. It should land in Fedora 41 stable in one week (bodhi link).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants