rr- / screeninfo

Fetch location and size of physical screens.
Other
208 stars 36 forks source link

Ubuntu 22.04: No enumerators available #71

Open iandol opened 2 years ago

iandol commented 2 years ago

On Ubuntu 22.04 running under X11 (not Wayland), with screeninfo 0.8.1.

I'm hitting this error as screeninfo is a dependency of https://github.com/threedworld-mit/tdw -- xrandr works fine directly in the command line...

▶︎ python3 -m screeninfo xrandr

Traceback (most recent call last):
  File "/home/linuxbrew/.linuxbrew/opt/python@3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/linuxbrew/.linuxbrew/opt/python@3.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/cog5/.virtualenvs/tdw/lib/python3.10/site-packages/screeninfo/__main__.py", line 23, in <module>
    main()
  File "/home/cog5/.virtualenvs/tdw/lib/python3.10/site-packages/screeninfo/__main__.py", line 18, in main
    for monitor in get_monitors(args.enumerator):
  File "/home/cog5/.virtualenvs/tdw/lib/python3.10/site-packages/screeninfo/screeninfo.py", line 21, in get_monitors
    return list(ENUMERATOR_MAP[Enumerator(name)].enumerate_monitors())
  File "/home/cog5/.virtualenvs/tdw/lib/python3.10/site-packages/screeninfo/enumerators/xrandr.py", line 65, in enumerate_monitors
    xlib = load_library("X11")
  File "/home/cog5/.virtualenvs/tdw/lib/python3.10/site-packages/screeninfo/util.py", line 11, in load_library
    return ctypes.cdll.LoadLibrary(path)
  File "/home/linuxbrew/.linuxbrew/opt/python@3.10/lib/python3.10/ctypes/__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "/home/linuxbrew/.linuxbrew/opt/python@3.10/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libX11.so.6: cannot open shared object file: No such file or directory
 ▷ python3 -m screeninfo xinerama

Traceback (most recent call last):
  File "/home/linuxbrew/.linuxbrew/opt/python@3.10/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/linuxbrew/.linuxbrew/opt/python@3.10/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/cog5/.virtualenvs/tdw/lib/python3.10/site-packages/screeninfo/__main__.py", line 23, in <module>
    main()
  File "/home/cog5/.virtualenvs/tdw/lib/python3.10/site-packages/screeninfo/__main__.py", line 18, in main
    for monitor in get_monitors(args.enumerator):
  File "/home/cog5/.virtualenvs/tdw/lib/python3.10/site-packages/screeninfo/screeninfo.py", line 21, in get_monitors
    return list(ENUMERATOR_MAP[Enumerator(name)].enumerate_monitors())
  File "/home/cog5/.virtualenvs/tdw/lib/python3.10/site-packages/screeninfo/enumerators/xinerama.py", line 20, in enumerate_monitors
    xlib = load_library("X11")
  File "/home/cog5/.virtualenvs/tdw/lib/python3.10/site-packages/screeninfo/util.py", line 11, in load_library
    return ctypes.cdll.LoadLibrary(path)
  File "/home/linuxbrew/.linuxbrew/opt/python@3.10/lib/python3.10/ctypes/__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "/home/linuxbrew/.linuxbrew/opt/python@3.10/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libX11.so.6: cannot open shared object file: No such file or directory
alters-mit commented 2 years ago

I see that you've already opened an issue in the screeninfo repo. Maybe in the meantime TDW should just catch the OSError and then try to parse xrandr -q

alters-mit commented 2 years ago

You're trying to call TDWUtils.get_expected_window_position(), right? Otherwise this error shouldn't happen. You could potentially just remove that function and manually set the window position.

iandol commented 2 years ago

Correct on TDWUtils.get_expected_window_position(), I will try the workaround to not trigger this screeninfo probblem. I opened an issue here just so the author of screeninfo was aware, and @alters-mit I think you meant to post you reply on the TDW issue :)