open-interpreter icon indicating copy to clipboard operation
open-interpreter copied to clipboard

KeyError: 'XDG_SESSION_TYPE' on startup

Open twilwa opened this issue 1 year ago • 2 comments

Describe the bug

When starting interpreter --os from the command line, the command fails and the following error occurs:

(.venv) anon@Frankenbako:~/active-tools-stack/interpreter$ interpreter --os Traceback (most recent call last): File "/home/anon/active-tools-stack/interpreter/.venv/bin/interpreter", line 8, in sys.exit(interpreter.start_terminal_interface()) File "/home/anon/active-tools-stack/interpreter/.venv/lib/python3.10/site-packages/interpreter/core/core.py", line 25, in start_terminal_interface start_terminal_interface(self) File "/home/anon/active-tools-stack/interpreter/.venv/lib/python3.10/site-packages/interpreter/terminal_interface/start_terminal_interface.py", line 463, in start_terminal_interface import(package) File "/home/anon/active-tools-stack/interpreter/.venv/lib/python3.10/site-packages/pywinctl/init.py", line 27, in from ._main import (Re, Window, checkPermissions, getActiveWindow, File "/home/anon/active-tools-stack/interpreter/.venv/lib/python3.10/site-packages/pywinctl/_main.py", line 14, in from pymonctl import findMonitorsAtPoint, getAllMonitors, getAllMonitorsDict File "/home/anon/active-tools-stack/interpreter/.venv/lib/python3.10/site-packages/pymonctl/init.py", line 22, in from ._main import (getAllMonitors, getAllMonitorsDict, getMonitorsCount, getPrimary, File "/home/anon/active-tools-stack/interpreter/.venv/lib/python3.10/site-packages/pymonctl/_main.py", line 916, in from ._pymonctl_linux import (_getAllMonitors, _getAllMonitorsDict, _getMonitorsCount, _getPrimary, File "/home/anon/active-tools-stack/interpreter/.venv/lib/python3.10/site-packages/pymonctl/_pymonctl_linux.py", line 22, in from ewmhlib import defaultEwmhRoot, getProperty, getPropertyValue, getRoots, getRootsInfo, Props File "/home/anon/active-tools-stack/interpreter/.venv/lib/python3.10/site-packages/ewmhlib/init.py", line 23, in from ._main import (displaysCount, getDisplays, getDisplaysInfo, getRoots, getRootsInfo, File "/home/anon/active-tools-stack/interpreter/.venv/lib/python3.10/site-packages/ewmhlib/_main.py", line 4, in from ._ewmhlib import (displaysCount, getDisplays, getDisplaysInfo, getRoots, getRootsInfo, File "/home/anon/active-tools-stack/interpreter/.venv/lib/python3.10/site-packages/ewmhlib/_ewmhlib.py", line 60, in displaysCount: int = len(getDisplays()) File "/home/anon/active-tools-stack/interpreter/.venv/lib/python3.10/site-packages/ewmhlib/_ewmhlib.py", line 45, in getDisplays if not _displays and os.environ['XDG_SESSION_TYPE'].lower() != "wayland": File "/usr/lib/python3.10/os.py", line 680, in getitem raise KeyError(key) from None KeyError: 'XDG_SESSION_TYPE'

I'm running the application in a WSL2 environment on Windows Home 11 with Ubuntu 22.04 for the WSL env. I've installed interpreter via pip into a .venv folder in the 'interpreter' directory i created to house interpreter's workspace. .venv is currently activated.

Reproduce

wsl.exe cd ~/interpreter source .venv/bin/activate interpreter --os

Expected behavior

Intepreter starts up successfully.

Screenshots

image

Open Interpreter version

0.2.0

Python version

3.10.12

Operating System name and version

Windows 11 Home -- WSL2 env

Additional context

No response

twilwa avatar Jan 18 '24 22:01 twilwa

I fixed that with:

export XDG_SESSION_TYPE=x11

can add that to .bashrc

ar4wnnn avatar Jan 18 '24 22:01 ar4wnnn

--os mode doesn't work on wayland, due to pyautogui (clicks and keys) not supporting wayland. as @ar4wnnn said export XDG_SESSION_TYPE=x11 seems to be the way for now

Notnaton avatar Jan 22 '24 18:01 Notnaton