GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — randr: inherit XError in error classes by fransklaver · Pull Request #242 · python-xlib/python-xlib

Conversation

@fransklaver

@fransklaver fransklaver commented Nov 8, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Commit c87624d ('Add Randr error classes and register them during init') introduces three new error classes to xrandr, but makes them inherit from Exception.

Let all error classes in randr inherit from Xerror, like all other code expects.

Fixes the traceback

...
      File "/tmp/python-env/lib/python3.8/site-packages/Xlib/display.py", line 182, in sync
        self.get_pointer_control()
      File "/tmp/python-env/lib/python3.8/site-packages/Xlib/display.py", line 833, in get_pointer_control
        return request.GetPointerControl(display = self.display)
      File "/tmp/python-env/lib/python3.8/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
        self.reply()
      File "/tmp/python-env/lib/python3.8/site-packages/Xlib/protocol/rq.py", line 1381, in reply
        self._display.send_and_recv(request = self._serial)
      File "/tmp/python-env/lib/python3.8/site-packages/Xlib/protocol/display.py", line 612, in send_and_recv
        gotreq = self.parse_response(request)
      File "/tmp/python-env/lib/python3.8/site-packages/Xlib/protocol/display.py", line 719, in parse_response
        gotreq = self.parse_error_response(request) or gotreq
      File "/tmp/python-env/lib/python3.8/site-packages/Xlib/protocol/display.py", line 745, in parse_error_response
        req = self.get_waiting_request(e.sequence_number)
    AttributeError: 'BadRRModeError' object has no attribute 'sequence_number'

fixes #241

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Avasam, ErikBjare, RedBearAK, and user202729 reacted with thumbs up emoji
All reactions
  • 👍 4 reactions
@fransklaver
fransklaver force-pushed the randr-errors-inherit-xerror branch 2 times, most recently from ef0cc66 to 9a6fc9c Compare November 8, 2022 11:46
@fransklaver fransklaver mentioned this pull request Nov 8, 2022
Removed unused imports #239
Merged
@Avasam

Avasam commented Nov 16, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

I've noticed this as well while working on type definitions. extension_add_error should expect a XError, but BadRROutputError, BadRRCrtcError and BadRRModeError aren't.

What about the other Error classes?
image

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Avasam Avasam mentioned this pull request Nov 17, 2022
py.typed and type comments #251
Draft
@fransklaver

fransklaver commented Nov 18, 2022

Copy link
Copy Markdown
Author

What about the other Error classes?

I would expect that those errors also derive from xlib.XError if they are to be used as such.

They didn't crash my program, and as these specific classes had been added recently, I hadn't bothered to look any further. Feel free to fix the others too.

Avasam reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vasily-v-ryabov

vasily-v-ryabov commented Dec 25, 2022

Copy link
Copy Markdown
Collaborator

@fransklaver thanks for the fix! Please resolve conflicts before merging it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@fransklaver
randr: inherit XError in error classes
52800b1
Commit c87624d ('Add Randr error classes and register them during
init') introduces three new error classes to xrandr, but makes them
inherit from Exception.

Let all error classes in randr inherit from Xerror, like all other code
expects.

Fixes the traceback

```
...
  File "/tmp/python-env/lib/python3.8/site-packages/Xlib/display.py", line 182, in sync
    self.get_pointer_control()
  File "/tmp/python-env/lib/python3.8/site-packages/Xlib/display.py", line 833, in get_pointer_control
    return request.GetPointerControl(display = self.display)
  File "/tmp/python-env/lib/python3.8/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
    self.reply()
  File "/tmp/python-env/lib/python3.8/site-packages/Xlib/protocol/rq.py", line 1381, in reply
    self._display.send_and_recv(request = self._serial)
  File "/tmp/python-env/lib/python3.8/site-packages/Xlib/protocol/display.py", line 612, in send_and_recv
    gotreq = self.parse_response(request)
  File "/tmp/python-env/lib/python3.8/site-packages/Xlib/protocol/display.py", line 719, in parse_response
    gotreq = self.parse_error_response(request) or gotreq
  File "/tmp/python-env/lib/python3.8/site-packages/Xlib/protocol/display.py", line 745, in parse_error_response
    req = self.get_waiting_request(e.sequence_number)
AttributeError: 'BadRRModeError' object has no attribute 'sequence_number'
```

fixes python-xlib#241
@fransklaver
fransklaver force-pushed the randr-errors-inherit-xerror branch from 9a6fc9c to 52800b1 Compare December 25, 2022 21:24
@codecov-commenter

codecov-commenter commented Dec 25, 2022

Copy link
Copy Markdown

Codecov Report

Merging #242 (52800b1) into master (4e8bbf8) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #242   +/-   ##
=======================================
  Coverage   78.21%   78.21%           
=======================================
  Files          42       42           
  Lines        4705     4705           
=======================================
  Hits         3680     3680           
  Misses       1025     1025           
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@petli

petli commented Dec 28, 2022

Copy link
Copy Markdown
Contributor

What about the other Error classes?

I would expect that those errors also derive from xlib.XError if they are to be used as such.

XError represents errors that are returned from the server and is deserialised from the protocol error message, while the other ones are client-side errors where none of that information is available. Thus it wouldn't make sense to use XError as the base for all exceptions in Xlib, but a new intermediary exception class could be introduced for that purpose if that would be useful (maybe XlibError or XlibException, or maybe there's some other recommendations in modern Python).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@fransklaver

fransklaver commented Dec 28, 2022

Copy link
Copy Markdown
Author

What about the other Error classes?

I would expect that those errors also derive from xlib.XError if they are to be used as such.

XError represents errors that are returned from the server and is deserialised from the protocol error message, while the other ones are client-side errors where none of that information is available. Thus it wouldn't make sense to use XError as the base for all exceptions in Xlib, but a new intermediary exception class could be introduced for that purpose if that would be useful (maybe XlibError or XlibException, or maybe there's some other recommendations in modern Python).

That's basically what I meant, yes. If they won't be treated like they're XErrors, there is no point in having them inherit XError. For clarity it could be useful to introduce an intermediate layer, I agree.

petli reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@petli

petli commented Dec 28, 2022

Copy link
Copy Markdown
Contributor

That's basically what I meant, yes. If they won't be treated like they're XErrors, there is no point in having them inherit XError.

I see, sorry for the misunderstanding! My brain haven't fully booted up today.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@fransklaver

fransklaver commented Dec 28, 2022

Copy link
Copy Markdown
Author

I see, sorry for the misunderstanding! My brain haven't fully booted up today.

No worries. It only clarifies stuff for other people whose brains haven't fully booted yet ;).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

t-wissmann added a commit to herbstluftwm/herbstluftwm that referenced this pull request Mar 9, 2023
@t-wissmann
Stick to old python-xlib in CI until bugfix
f0dc213
In python-xlib 0.32, the bug python-xlib/python-xlib#242
was introduced which caused `test_floatplacement_smart_create_many` to
fail deterministically. There already is a pull request in `python-xlib`
with a fix, but it is not merged yet. So for the time being, let's
simply use the old python-xlib version.
@t-wissmann t-wissmann mentioned this pull request Mar 9, 2023
Stick to old python-xlib in CI until bugfix herbstluftwm/herbstluftwm#1544
Merged
mergify Bot pushed a commit to herbstluftwm/herbstluftwm that referenced this pull request Mar 9, 2023
@t-wissmann
Stick to old python-xlib in CI until bugfix (#1544)
23ab0e1
In python-xlib 0.32, the bug python-xlib/python-xlib#242 was introduced which caused `test_floatplacement_smart_create_many` to fail deterministically. There already is a pull request in `python-xlib` with a fix, but it is not merged yet. So for the time being, let's simply use the old python-xlib version.
@ErikBjare

ErikBjare commented Aug 28, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Is this not being considered for merging? We're facing #241 / #259 in our project where our end-users have spuriously had processes hang at 100% CPU until restarted.

We are considering pinning 0.31 until a fix is released. However, we ourselves have a slow release cycle with lots of testing/prereleases, so hoping someone can pick this up before we ship a stable one. (as others seem to have done already in herbstluftwm/herbstluftwm#1544)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ErikBjare ErikBjare mentioned this pull request Aug 28, 2023
[Linux] 'BadRRModeError' object has no attribute 'sequence_number' ActivityWatch/aw-watcher-window#89
Closed
@RedBearAK RedBearAK mentioned this pull request Aug 29, 2023
Random crash at X11 joshgoebel/keyszer#161
Open
@ErikBjare

ErikBjare commented Sep 13, 2023

Copy link
Copy Markdown

@vasily-v-ryabov Any chance this will be considered for merge? Or should I just downgrade?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ErikBjare ErikBjare mentioned this pull request Sep 13, 2023
0.32 throws AttributeError: 'BadRRModeError' object has no attribute 'sequence_number' #241
Open
@fransklaver

fransklaver commented Sep 13, 2023

Copy link
Copy Markdown
Author

@ErikBjare We've had the version pinned to 0.31 ever since I stumbled upon this issue. The previous release should really have included this fix, and upon request I updated the pull request as soon as I could. I haven't had any further communication about this from @vasily-v-ryabov either.

@vasily-v-ryabov do you need help maintaining this project?

ErikBjare and thegravelinspector reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ErikBjare

ErikBjare commented Sep 13, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Looking at the commit history there have been no new commits on master since December?

Not holding my breath. Saw that last commits were co-authored by Vasily, figured I would ping.

Given the stability of the Xorg/xlib APIs we use, we might keep the version pinned for a long time to prevent further issues (as issues would lead to data loss in our case).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cruizba cruizba mentioned this pull request Nov 23, 2023
Use version 0.31 of python-xlib to fix regression selkies-project/selkies#113
Closed
@ehfd

ehfd commented Nov 25, 2023

Copy link
Copy Markdown

@benoit-pierre do you also have write access to this repository?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thegravelinspector thegravelinspector mentioned this pull request Feb 5, 2024
keyd-application-mapper -d sometimes uses 100% CPU until it gets restarted rvaiya/keyd#553
Open
@redhog

redhog commented Apr 29, 2024

Copy link
Copy Markdown

Heys! I was planning to make a PR for some convenience syntax sugar stuff, but the commit history of master and the above comments don't look promising / makes this look pointless. What is the plan for maintaining this library? Does anybody know?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@fransklaver

fransklaver commented May 1, 2024

Copy link
Copy Markdown
Author

I have no idea what the plan is for this repository.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ErikBjare

ErikBjare commented May 1, 2024

Copy link
Copy Markdown

Neither do I, but I wouldn't expect such a PR to get merged. At least not any time soon.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ehfd ehfd mentioned this pull request May 1, 2024
selkies-gstream hit 100% CPU selkies-project/docker-selkies-egl-desktop#33
Closed
@ehfd

ehfd commented May 1, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

https://github.com/selkies-project/python-xlib/pulls?q=is%3Apr

I just merged all trivial PRs to my organization's fork. I can give out write access. @Avasam @fransklaver

Use python-xlib @ https://github.com/selkies-project/python-xlib/archive/master.zip for setuptools or pip.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Avasam

Avasam commented May 2, 2024

Copy link
Copy Markdown
Contributor

@ehfd This repo does look unmaintained, if not abandoned. I'm mostly interested in #251 . Which I could rewrite much better if you're willing to drop EOL Python (or at least anything under 3.7)

In the mean time, I added stubs to typeshed: https://pypi.org/project/types-python-xlib/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ehfd

ehfd commented May 2, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

@Avasam
I had to revert your commits (but nonetheless preserved this one) because one of them showed some new regressions with my project with capturing the cursor image consistently. I'd like to check which commit it is when I have time.

Would be grateful if you could help out advancing the fork in any way and testing its reliability.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@petli

petli commented Jul 5, 2024

Copy link
Copy Markdown
Contributor

Speaking as the original author and lapsed maintainer (e.g. coming very late to this thread) this library would really need some active maintainers. I don't use XWindows anymore myself, and I think @vasily-v-ryabov has said something along the same lines.

ErikBjare reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@fransklaver

fransklaver commented Jul 5, 2024

Copy link
Copy Markdown
Author

@petli are you in a position to do something about the maintainer issue? Or would we need to contact @vasily-v-ryabov for that?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@petli

petli commented Jul 5, 2024

Copy link
Copy Markdown
Contributor

@fransklaver I think I count as a maintainer still and could add new ones to the project. I would have to look at pypi publishing, I'm not sure if I have any permissions there. Maybe move this into a discussion thread for visibility?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@fransklaver

fransklaver commented Jul 5, 2024

Copy link
Copy Markdown
Author

@petli That sounds like a good idea, not sure where or how at this point, though

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ehfd

ehfd commented Jul 5, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

@petli @fransklaver Discussions are not available in the GitHub repository, apparently (need to enable). Really keen about someone being able to maintain.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@petli

petli commented Jul 8, 2024

Copy link
Copy Markdown
Contributor

@ehfd @fransklaver I've enabled discussions now, wasn't aware that I needed to do it first, and posted #273 there.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sdht0 sdht0 mentioned this pull request Apr 3, 2025
activitywatch: newer xlib dependency causing process to fail NixOS/nixpkgs#395872
Open
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

0.32 throws AttributeError: 'BadRRModeError' object has no attribute 'sequence_number'

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@fransklaver @Avasam @vasily-v-ryabov @codecov-commenter @petli @ErikBjare @ehfd @redhog
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.