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

Pynput crashes on openSUSE LEAP 15 #148

Closed
TheLastProject opened this issue Apr 4, 2019 · 6 comments
Closed

Pynput crashes on openSUSE LEAP 15 #148

TheLastProject opened this issue Apr 4, 2019 · 6 comments

Comments

@TheLastProject
Copy link

I believe this may be related to Wayland, although I have been told that LEAP 15 uses XWayland.

See Pext/Pext#168 for more info.

Any way I can help debug this?

@moses-palmer
Copy link
Owner

moses-palmer commented Apr 5, 2019 via email

@TheLastProject
Copy link
Author

The stack trace is in the linked issue, I'm pasting it here for completeness:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pext/__main__.py", line 62, in <module>
    from pynput import keyboard
  File "/usr/lib/python3.6/site-packages/pynput/__init__.py", line 40, in <module>
    from . import keyboard
  File "/usr/lib/python3.6/site-packages/pynput/keyboard/__init__.py", line 49, in <module>
    from ._xorg import KeyCode, Key, Controller, Listener
  File "/usr/lib/python3.6/site-packages/pynput/keyboard/_xorg.py", line 39, in <module>
    from pynput._util.xorg import (
  File "/usr/lib/python3.6/site-packages/pynput/_util/xorg.py", line 40, in <module>
    _check()
  File "/usr/lib/python3.6/site-packages/pynput/_util/xorg.py", line 38, in _check
    display = Xlib.display.Display()
  File "/usr/lib/python3.6/site-packages/Xlib/display.py", line 89, in __init__
    self.display = _BaseDisplay(display)
  File "/usr/lib/python3.6/site-packages/Xlib/display.py", line 71, in __init__
    protocol_display.Display.__init__(self, *args, **keys)
  File "/usr/lib/python3.6/site-packages/Xlib/protocol/display.py", line 160, in __init__
    raise error.DisplayConnectionError(self.display_name, r.reason)
Xlib.error.DisplayConnectionError: Can't connect to display ":0": b'No protocol specified\n'

@davidlares
Copy link

davidlares commented Mar 6, 2020

This error is not only for OpenSUSE. I'm having the same issue on a Ubuntu machine as well, I'm using virtualenv with the 1.6.8 version (based on the same stack-trace placed above)

EDIT 1: I was checking the limitations resource but I'm confused about the X Server and the $DISPLAY variable. By ps -e | grep X I got:

2367 tty1 00:00:00 Xwayland
6306 tty2 00:23:50 Xorg
17941 ? 00:00:05 VBoxXPCOMIPCD

My display variable is :0

EDIT 2: I just noticed about the Wayland incompatibility, this affects the GNOME3 directly, so the Ubuntu family can't use this package, am I right?

Thanks in advance.

@mohammedyunus009
Copy link

Even im facing the same issue here (ubuntu 16) . Can anyone please suggest me to log long key press . Or any other module where i can log long key press . ? Thanks in advance

@moses-palmer
Copy link
Owner

@TheLastProject, did you have a look at this post? This error could be caused by a bug in python-xlib, and is said to be solved by issuing xhost + in the terminal.

@davidlares, @mohammedyunus009, If your problem is running under Wayland, a possible solution would be to use the uinput backend. You will find more information here.

In any case, this appears to be a bug in a dependency with a known workaround, so I will close this issue.

@simotek
Copy link

simotek commented Aug 2, 2021

Can confirm the issue on openSUSE and the xhost + fix do you know of a bugreport in python-xlib so I can look at getting the fix?

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

5 participants