Sitelet https://web.archive.org/web/20210106130910/https://github.com/python-xlib/python-xlib/issues/127
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

BrokenPipeError not correctly handled #127

Open
oneindelijk opened this issue Oct 22, 2018 · 2 comments
Open

BrokenPipeError not correctly handled #127

oneindelijk opened this issue Oct 22, 2018 · 2 comments
Labels

Comments

@oneindelijk
Copy link

@oneindelijk oneindelijk commented Oct 22, 2018 •

I get this error when using pynput (it completely crashes my X)

Exception in thread Thread-4481:
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/Xlib/protocol/display.py", line 584, in send_and_recv
    i = self.socket.send(self.data_send)
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/site-packages/pynput/_util/__init__.py", line 136, in run
    self._run()
  File "/usr/lib/python3.7/site-packages/pynput/keyboard/_xorg.py", line 499, in _run
    super(Listener, self)._run()
  File "/usr/lib/python3.7/site-packages/pynput/_util/xorg.py", line 401, in _run
    self._suppress_stop(dm)
  File "/usr/lib/python3.7/contextlib.py", line 119, in __exit__
    next(self.gen)
  File "/usr/lib/python3.7/site-packages/pynput/_util/xorg.py", line 74, in display_manager
    display.sync()
  File "/usr/lib/python3.7/site-packages/Xlib/display.py", line 182, in sync
    self.get_pointer_control()
  File "/usr/lib/python3.7/site-packages/Xlib/display.py", line 833, in get_pointer_control
    return request.GetPointerControl(display = self.display)
  File "/usr/lib/python3.7/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
    self.reply()
  File "/usr/lib/python3.7/site-packages/Xlib/protocol/rq.py", line 1381, in reply
    self._display.send_and_recv(request = self._serial)
  File "/usr/lib/python3.7/site-packages/Xlib/protocol/display.py", line 586, in send_and_recv
    self.close_internal('server: %s' % err[1])
TypeError: 'BrokenPipeError' object is not subscriptable

So the exception mightbe something from pynput or that I'm doing wrong,
but the exception following the exception seems to be in
/usr/lib/python3.7/site-packages/Xlib/protocol/display.py", line 586

@oneindelijk
Copy link
Author

@oneindelijk oneindelijk commented Oct 23, 2018

This only seem to happen when adding the paramater suppress=True to the Listener

t-wissmann added a commit to t-wissmann/python-xlib that referenced this issue Mar 21, 2020
The socket.error, which is an alias to OSError since python 3.3, is not
subscriptable (and its subclasses neither are). Hence, pass the entire
exception message to close_internal().

In case of a socket.error in self.socket.send(), the former crashed with
a TypeError.

I strongly suspect that this closes issue python-xlib#127.
@vasily-v-ryabov
Copy link
Collaborator

@vasily-v-ryabov vasily-v-ryabov commented Apr 7, 2020

@oneindelijk if it's still actual, please check if release 0.27 fixes this issue.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.