fix: Handle undefined DISPLAY environment variable for pyautogui (#1552)#1681
Open
majiayu000 wants to merge 1 commit intoopeninterpreter:mainfrom
Open
fix: Handle undefined DISPLAY environment variable for pyautogui (#1552)#1681majiayu000 wants to merge 1 commit intoopeninterpreter:mainfrom
majiayu000 wants to merge 1 commit intoopeninterpreter:mainfrom
Conversation
…ninterpreter#1552) When DISPLAY is not set (e.g., SSH sessions without X11 forwarding), pyautogui import fails with KeyError: 'DISPLAY'. This commit adds graceful error handling: - Wrap pyautogui imports in try/except blocks - Use fallback screen size when pyautogui unavailable - Raise clear ToolError when computer tool is actually used - Skip mouse position checking thread when no display - Add pytest skip for display-dependent tests on Linux without DISPLAY - Add unit tests for DISPLAY handling Fixes openinterpreter#1552 Signed-off-by: majiayu000 <1835304752@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Describe the changes you have made:
When DISPLAY is not set (e.g., SSH sessions without X11 forwarding), pyautogui import fails with
KeyError: 'DISPLAY'. This commit adds graceful error handling:computer.pyandloop.pyToolErrorwhen computer tool is actually used without displaytest_display_env.py)Reference any relevant issues (e.g. "Fixes #000"):
Fixes #1552
Pre-Submission Checklist (optional but appreciated):
docs/CONTRIBUTING.mddocs/ROADMAP.mdOS Tests (optional but appreciated):