Skip to content

Headless Display interface broken on Linux since 2.1.8 #1350

@duburcqa

Description

@duburcqa

Describe the bug

I'm getting this error when trying to get the headless display information since 2.1.8. It was working fine with 2.1.6 and earlier versions.

System Information:

This bug is not machine specific. I can reproduce it on many Python version (<3.14,>3.9) and different Linux OSes (Ubuntu 22, Ubuntu 24). It works fine on Mac OS and Windows OS.

How To Reproduce

In [1]: import pyglet
   ...: pyglet.options["headless"] = True
   ...: display = pyglet.display.get_display()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[1], line 3
      1 import pyglet
      2 pyglet.options["headless"] = True
----> 3 display = pyglet.display.get_display()

File /opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/pyglet/display/__init__.py:77, in get_display()
     74     return display
     76 # Otherwise, create a new display and return it.
---> 77 return Display()

File /opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/site-packages/pyglet/display/headless.py:17, in HeadlessDisplay.__init__(self)
     15 super().__init__()
     16 # TODO: fix this placeholder:
---> 17 self._screens = [HeadlessScreen(self, 0, 0, 1920, 1080)]
     19 num_devices = egl.EGLint()
     20 eglext.eglQueryDevicesEXT(0, None, byref(num_devices))

TypeError: Can't instantiate abstract class HeadlessScreen without an implementation for abstract methods 'get_display_id', 'get_monitor_name'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions