Giter VIP home page Giter VIP logo

Comments (5)

moses-palmer avatar moses-palmer commented on July 20, 2024

Sorry for the late reply.

I have tested installing pynput in a Debian docker container as follows:

user@host:~$ docker run -ti --rm -e DISPLAY=:1 -v /tmp/.X11-unix:/tmp/.X11-unix debian

root@docker:~$ apt update && apt install python-pip && pip install pynput
root@docker:~$ python -c 'import pynput; pynput.mouse.Controller().position = (5, 5)'

This works. I get no errors about six missing, and no startup errors from python-xlib.

My suggestion is to first purge all installed packages and reinstall them as your user, and then to ensure that python-xlib is up-to-date.

from pynput.

moses-palmer avatar moses-palmer commented on July 20, 2024

Did you solve this problem? I will close this issue now, but please reopen it if the problem remains.

from pynput.

ap1726 avatar ap1726 commented on July 20, 2024

Hello!
The problem is similar to the one described in this issue, but there is python 2.7, and I have 3.7 and RPI4.
When I installed the package with:

pip install pynput
 pip3 install pynput

I got the following errors:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/pynput/keyboard/_xorg.py", line 85, in _from_symbol
    **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pynput/keyboard/_base.py", line 131, in from_vk
    return cls(vk=vk, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pynput/keyboard/_base.py", line 62, in __init__
    raise ValueError(kwargs)
ValueError: {'is_media': True}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "MyScript.py", line 10, in <module>
    import pynput
  File "/usr/local/lib/python3.7/dist-packages/pynput/__init__.py", line 40, in <module>
    from . import keyboard
  File "/usr/local/lib/python3.7/dist-packages/pynput/keyboard/__init__.py", line 49, in <module>
    from ._xorg import KeyCode, Key, Controller, Listener
  File "/usr/local/lib/python3.7/dist-packages/pynput/keyboard/_xorg.py", line 105, in <module>
    class Key(enum.Enum):
  File "/usr/local/lib/python3.7/dist-packages/pynput/keyboard/_xorg.py", line 156, in Key
    media_play_pause = KeyCode._from_media('Play')
  File "/usr/local/lib/python3.7/dist-packages/pynput/keyboard/_xorg.py", line 102, in _from_media
    return cls._from_symbol('XF86Audio' + name, is_media=True, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pynput/keyboard/_xorg.py", line 90, in _from_symbol
    **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pynput/keyboard/_base.py", line 131, in from_vk
    return cls(vk=vk, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/pynput/keyboard/_base.py", line 62, in __init__
    raise ValueError(kwargs)
ValueError: {'is_media': True}

It turned out that the rpi4 using pynput==1.5.0. When I installed version 1.4.5 the problem was solved.

from pynput.

moses-palmer avatar moses-palmer commented on July 20, 2024

Thank you for your report.

The introduction of experimental support for media keys in pynput 1.5.0 unfortunately broke two of the three supported backends. I have pushed fixes for macOS and Xorg; can you test with pynput 1.5.2?

from pynput.

ap1726 avatar ap1726 commented on July 20, 2024

I installed version 1.5.2. It's okay, it's working. Thanks!

from pynput.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.