René's URL Explorer Experiment


Title: python-xlib fails to parse X server Visual/Depth info on Void Linux (Python 3.11/3.13) · Issue #282 · python-xlib/python-xlib · GitHub

Open Graph Title: python-xlib fails to parse X server Visual/Depth info on Void Linux (Python 3.11/3.13) · Issue #282 · python-xlib/python-xlib

X Title: python-xlib fails to parse X server Visual/Depth info on Void Linux (Python 3.11/3.13) · Issue #282 · python-xlib/python-xlib

Description: Bug Report: python-xlib fails to retrieve standard X server Visual/Depth information Description: I am encountering a persistent and unusual issue where python-xlib (both 0.33 and 0.29) on Void Linux (using Python 3.13 and Python 3.11) i...

Open Graph Description: Bug Report: python-xlib fails to retrieve standard X server Visual/Depth information Description: I am encountering a persistent and unusual issue where python-xlib (both 0.33 and 0.29) on Void Lin...

X Description: Bug Report: python-xlib fails to retrieve standard X server Visual/Depth information Description: I am encountering a persistent and unusual issue where python-xlib (both 0.33 and 0.29) on Void Lin...

Opengraph URL: https://github.com/python-xlib/python-xlib/issues/282

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"python-xlib fails to parse X server Visual/Depth info on Void Linux (Python 3.11/3.13)","articleBody":"### Bug Report: `python-xlib` fails to retrieve standard X server Visual/Depth information\n\n**Description:**\nI am encountering a persistent and unusual issue where `python-xlib` (both 0.33 and 0.29) on Void Linux (using Python 3.13 and Python 3.11) is unable to properly retrieve and expose X server visual and depth information, leading to `AttributeError` on expected properties and an inability to find the default visual in `screen.allowed_depths`.\n\nMy X server is functioning normally and reports standard visual information via `xdpyinfo`.\n\n**Environment:**\n* **Operating System:** Void Linux (x86_64)\n* **Python Version (tested):** Python 3.13.0) and Python 3.11.12_2\n* **`python-xlib` Version (tested):** 0.33 and 0.29\n* **X Server:** \"Xorg\" \n* **Desktop Environment/Window Manager:** Openbox\n\n**Steps to Reproduce:**\n1.  Create a Python virtual environment (tested with both Python 3.13 and Python 3.11).\n2.  Install `python-xlib==0.33` (then later tried 0.29) into the environment:\n    `pip install python-xlib==0.33` (then `pip install python-xlib==0.29`)\n3.  Ran Python script `test_xlib.py` to check basic `screen` properties.\n4.  Ran Python script `center_dot.py` which attempts to find and use the default visual.\n\n**Expected Behavior:**\nThe `python-xlib` library should successfully access properties like `screen.default_visual`, `screen.default_depth`, `root.get_geometry().visual`, and `visual_obj.id` within `screen.allowed_depths`. It should be able to identify and use the default visual (0x20 / 32) and depth (24) reported by `xdpyinfo`.\n\n**Actual Behavior / Error Messages:**\n\n\n---\n**1. Output from `test_xlib.py` (with python-xlib 0.33):**\n\nSuccessfully connected to X server.\nScreen width: 1920\nScreen height: 1080\nRoot visual ID (screen.root_visual): 32\nRoot depth (screen.root_depth): 24\nAttributeError trying to get screen properties: get_visual_from_id\nThis indicates a deep issue with python-xlib's interaction with your X server.\nDisconnected from X server.\n\n**2. Output from `center_dot.py` (after attempts with `getattr` workaround, python-xlib 0.33, Python 3.13):**\nCRITICAL: Could not find a matching Visual object for ID 32 and depth 24. Exiting.\n\n*(Note: This occurred after the `AttributeError: id` was bypassed by `getattr`.)*\n\n**3. Output from `center_dot.py` (with python-xlib 0.29, Python 3.11):**\n\nWarning: 'screen.default_visual' or 'screen.default_depth' not found directly. Falling back to root geometry.\nTraceback (most recent call last):\nFile \"/home/XXX/pyxdg_env_py311/lib/python3.11/site-packages/Xlib/protocol/rq.py\", line 1294, in getattr\nreturn self._data[attr]\n~~~~~~~~~~^^^^^^\nKeyError: 'default_visual'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\nFile \"/home/XXXX/python_scripts/center_dot.py\", line 34, in create_centered_dot_overlay\nselected_visual = screen.default_visual\n^^^^^^^^^^^^^^^^^^^^^\nFile \"/home/XXXX/pyxdg_env_py311/lib/python3.11/site-packages/Xlib/protocol/rq.py\", line 1298, in getattr\nraise AttributeError(attr)\nAttributeError: default_visual\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\nFile \"/home/XXXX/pyxdg_env_py311/lib/python3.11/site-packages/Xlib/protocol/rq.py\", line 1294, in getattr\nreturn self._data[attr]\n~~~~~~~~~~^^^^^^\nKeyError: 'visual'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\nFile \"/home/XXXX/python_scripts/center_dot.py\", line 144, in \u0026lt;module\u003e\ncreate_centered_dot_overlay()\nFile \"/home/XXXX/python_scripts/center_dot.py\", line 41, in create_centered_dot_overlay\nif isinstance(geometry.visual, int):\n^^^^^^^^^^^^^^^\nFile \"/home/XXXX/pyxdg_env_py311/lib/python3.11/site-packages/Xlib/protocol/rq.py\", line 1298, in getattr\nraise AttributeError(attr)\nAttributeError: visual\n\n**4. Output from `xdpyinfo | grep -E \"visual|depths\"` (showing correct X server data):**\n\ndepths (7):     24, 1, 4, 8, 15, 16, 32\nnumber of visuals:    156\ndefault visual id:  0x20\nvisual:\nvisual id:      0x20\n\n**5. Python Script `test_xlib.py` (as provided earlier):**\n\n```python\n# ~/python_scripts/test_xlib.py\n#!/usr/bin/env python3\nimport Xlib.display\nimport Xlib.X\n\ntry:\n    display = Xlib.display.Display()\n    screen = display.screen()\n    root = screen.root\n\n    print(\"Successfully connected to X server.\")\n    print(f\"Screen width: {root.get_geometry().width}\")\n    print(f\"Screen height: {root.get_geometry().height}\")\n\n    try:\n        print(f\"Root visual ID (screen.root_visual): {screen.root_visual}\")\n        print(f\"Root depth (screen.root_depth): {screen.root_depth}\")\n\n        # This is the line that failed last:\n        test_visual_object = screen.get_visual_from_id(screen.root_visual)\n        print(f\"Got visual object from ID. Its ID is: {test_visual_object.id}\")\n\n    except AttributeError as e:\n        print(f\"AttributeError trying to get screen properties: {e}\")\n        print(\"This indicates a deep issue with python-xlib's interaction with your X server.\")\n    except Exception as e:\n        print(f\"An unexpected error occurred while getting screen properties: {e}\")\n\n    display.close()\n    print(\"Disconnected from X server.\")\n\nexcept Xlib.error.DisplayNameError:\n    print(\"ERROR: Cannot open display. Is X server running and DISPLAY environment variable set?\")\nexcept Exception as e:\n print(f\"An unexpected error occurred during Xlib initialization: {e}\")\n\n# ~/python_scripts/center_dot.py\n#!/usr/bin/env python3\nimport Xlib.display\nimport Xlib.X\nimport Xlib.protocol.event\nfrom Xlib.ext import xfixes\nimport time\n\ndef create_centered_dot_overlay():\n    display = Xlib.display.Display()\n    screen = display.screen()\n    root = screen.root\n\n    screen_width = root.get_geometry().width\n    screen_height = root.get_geometry().height\n    center_x = screen_width // 2\n    center_y = screen_height // 2\n\n    TARGET_VISUAL_ID_DEC = 32\n    TARGET_DEPTH = 24\n\n    selected_visual = None\n    found_depth = None\n\n    print(f\"Searching for visual ID {TARGET_VISUAL_ID_DEC} with depth {TARGET_DEPTH}...\")\n    for depth_info in screen.allowed_depths:\n        print(f\"  Checking depth: {depth_info.depth}\")\n        if depth_info.depth == TARGET_DEPTH:\n            for visual_obj in depth_info.visuals:\n                visual_id_val = getattr(visual_obj, 'id', None)\n                if visual_id_val is not None and visual_id_val == TARGET_VISUAL_ID_DEC:\n                    selected_visual = visual_obj\n                    found_depth = depth_info.depth\n                    print(f\"  --\u003e Found matching visual: ID {selected_visual.id}, Depth {found_depth}\")\n                    break\n            if selected_visual:\n                break\n\n    if selected_visual is None:\n        print(f\"CRITICAL: Could not find a matching Visual object for ID {TARGET_VISUAL_ID_DEC} and depth {TARGET_DEPTH} within screen.allowed_depths. Exiting.\")\n        print(\"This indicates a severe incompatibility or issue with your python-xlib installation or X server configuration.\")\n        display.close()\n        exit(1)\n\n    print(f\"Using visual ID: {selected_visual.id} with depth: {found_depth}\")\n    print(\"Transparency might not work without a compositing manager (Picom/Compton) and a suitable visual.\")\n\n    window = root.create_window(\n        0, 0, screen_width, screen_height, 0,\n        found_depth,\n        Xlib.X.InputOutput,\n        selected_visual,\n        Xlib.X.CWBackPixel | Xlib.X.CWEventMask | Xlib.X.CWOverrideRedirect | Xlib.X.CWColormap,\n        {\n            'background_pixel': 0,\n            'event_mask': Xlib.X.ExposureMask,\n            'override_redirect': True,\n            'colormap': display.create_colormap(root, selected_visual, Xlib.X.AllocNone)\n        }\n    )\n\n    NET_WM_STATE = display.intern_atom('_NET_WM_STATE')\n    _NET_WM_STATE_ABOVE = display.intern_atom('_NET_WM_STATE_ABOVE')\n    window.change_property(\n        Xlib.X.ChangePropertyModeReplace,\n        NET_WM_STATE,\n        Xlib.display.None_,\n        32,\n        [_NET_WM_STATE_ABOVE]\n    )\n    event = Xlib.protocol.event.ClientMessage(\n        window=window,\n        client_type=NET_WM_STATE,\n        data=(32, (_NET_WM_STATE_ABOVE, 1, 0, 0, 0))\n    )\n    root.send_event(event, Xlib.X.SubstructureNotifyMask | Xlib.X.SubstructureRedirectMask)\n\n    empty_region = xfixes.create_region(display)\n    xfixes.set_window_shape_region(display, window.id, Xlib.X.ShapeInput, 0, 0, empty_region)\n    empty_region.free()\n\n    window.map_window()\n    display.sync()\n\n    dot_color = screen.black_pixel\n    gc = window.create_gc(\n        foreground=dot_color,\n        function=Xlib.X.GXcopy\n    )\n\n    try:\n        while True:\n            event = display.next_event()\n            if event.type == Xlib.X.Expose:\n                dot_size = 3\n                window.fill_arc(gc, center_x - dot_size, center_y - dot_size,\n                                dot_size * 2, dot_size * 2, 0, 360 * 64)\n                display.flush()\n            time.sleep(0.01)\n    except KeyboardInterrupt:\n        print(\"\\nExiting dot overlay.\")\n    finally:\n        gc.free()\n        window.destroy()\n        display.close()\n\nif __name__ == \"__main__\":\n    create_centered_dot_overlay()\n\n\nxdpyinfo shows correct X server data.\nattempted different python-xlib versions and Python interpreter versions without success.\nissue isolated to python-xlib's internal handling of X server responses.\n","author":{"url":"https://github.com/Schaekker","@type":"Person","name":"Schaekker"},"datePublished":"2025-06-02T16:17:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/282/python-xlib/issues/282"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:8227b7d7-b52c-bde7-7b18-ad8af48566f5
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id845C:DAAA2:727C9:A23A1:696F9507
html-safe-nonce9fd1a0d31427ba60d26925aa7529fc5e25040b5894fa3f86fbd46ce2eb486f19
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDVDOkRBQUEyOjcyN0M5OkEyM0ExOjY5NkY5NTA3IiwidmlzaXRvcl9pZCI6IjIzMjg5Mjg3MzA3ODE1NTM5MjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac4d162c297b55f7afc861fb7ab626294860ff2173b383e2914898cd8b0200389a
hovercard-subject-tagissue:3110810465
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-xlib/python-xlib/282/issue_layout
twitter:imagehttps://opengraph.githubassets.com/8d1650781236e364e3e2f2dbaeaaa63b2707342c23ff6c9454b4784f2972a0a4/python-xlib/python-xlib/issues/282
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/8d1650781236e364e3e2f2dbaeaaa63b2707342c23ff6c9454b4784f2972a0a4/python-xlib/python-xlib/issues/282
og:image:altBug Report: python-xlib fails to retrieve standard X server Visual/Depth information Description: I am encountering a persistent and unusual issue where python-xlib (both 0.33 and 0.29) on Void Lin...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameSchaekker
hostnamegithub.com
expected-hostnamegithub.com
None0ca8d8c65612640b9a1a588b3eed68222ca723ed2d028b18fe81b28936d535eb
turbo-cache-controlno-preview
go-importgithub.com/python-xlib/python-xlib git https://github.com/python-xlib/python-xlib.git
octolytics-dimension-user_id16151530
octolytics-dimension-user_loginpython-xlib
octolytics-dimension-repository_id47391866
octolytics-dimension-repository_nwopython-xlib/python-xlib
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id47391866
octolytics-dimension-repository_network_root_nwopython-xlib/python-xlib
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release95f60616ce2765d1114fe6da4af405a58c6d26d2
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python-xlib/python-xlib/issues/282#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-xlib%2Fpython-xlib%2Fissues%2F282
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-xlib%2Fpython-xlib%2Fissues%2F282
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python-xlib%2Fpython-xlib
Reloadhttps://github.com/python-xlib/python-xlib/issues/282
Reloadhttps://github.com/python-xlib/python-xlib/issues/282
Reloadhttps://github.com/python-xlib/python-xlib/issues/282
python-xlib https://github.com/python-xlib
python-xlibhttps://github.com/python-xlib/python-xlib
Notifications https://github.com/login?return_to=%2Fpython-xlib%2Fpython-xlib
Fork 112 https://github.com/login?return_to=%2Fpython-xlib%2Fpython-xlib
Star 455 https://github.com/login?return_to=%2Fpython-xlib%2Fpython-xlib
Code https://github.com/python-xlib/python-xlib
Issues 65 https://github.com/python-xlib/python-xlib/issues
Pull requests 16 https://github.com/python-xlib/python-xlib/pulls
Discussions https://github.com/python-xlib/python-xlib/discussions
Actions https://github.com/python-xlib/python-xlib/actions
Projects 0 https://github.com/python-xlib/python-xlib/projects
Wiki https://github.com/python-xlib/python-xlib/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python-xlib/python-xlib/security
Please reload this pagehttps://github.com/python-xlib/python-xlib/issues/282
Insights https://github.com/python-xlib/python-xlib/pulse
Code https://github.com/python-xlib/python-xlib
Issues https://github.com/python-xlib/python-xlib/issues
Pull requests https://github.com/python-xlib/python-xlib/pulls
Discussions https://github.com/python-xlib/python-xlib/discussions
Actions https://github.com/python-xlib/python-xlib/actions
Projects https://github.com/python-xlib/python-xlib/projects
Wiki https://github.com/python-xlib/python-xlib/wiki
Security https://github.com/python-xlib/python-xlib/security
Insights https://github.com/python-xlib/python-xlib/pulse
New issuehttps://github.com/login?return_to=https://github.com/python-xlib/python-xlib/issues/282
New issuehttps://github.com/login?return_to=https://github.com/python-xlib/python-xlib/issues/282
python-xlib fails to parse X server Visual/Depth info on Void Linux (Python 3.11/3.13)https://github.com/python-xlib/python-xlib/issues/282#top
https://github.com/Schaekker
https://github.com/Schaekker
Schaekkerhttps://github.com/Schaekker
on Jun 2, 2025https://github.com/python-xlib/python-xlib/issues/282#issue-3110810465
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.