Skip to content

ecodes misses UInput Constants #238

Closed

Description

@antheas

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?

Activity

  1. antheas commented on Feb 20, 2025

    @antheas
    Author

    latter part is dupe of #236

  2. antheas commented on Feb 20, 2025

    @antheas
    Author

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

  3. antheas commented on Feb 20, 2025

    @antheas
    Author

    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))
  4. sezanzeb commented on Feb 20, 2025

    @sezanzeb
    Collaborator

    Hi, sorry, what do you mean with

    latter part is dupe of #236

    and

    Botch complete:

    ?

  5. antheas commented on Feb 20, 2025

    @antheas
    Author

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

  6. antheas commented on Feb 20, 2025

    @antheas
    Author

    latter part is dupe of #236

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

  7. sezanzeb commented on Feb 20, 2025

    @sezanzeb
    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?

  8. antheas commented on Feb 20, 2025

    @antheas
    Author

    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

  9. sezanzeb commented on Feb 20, 2025

    @sezanzeb
    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) ✗ 
    
  10. sezanzeb commented on Feb 21, 2025

    @sezanzeb
    Collaborator

    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.

  11. gvalkov commented on Feb 22, 2025

    @gvalkov
    Owner

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

  12. gvalkov commented on Feb 23, 2025

    @gvalkov
    Owner

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions