1 parent 3cf221c commit 1b4ff48Copy full SHA for 1b4ff48
1 file changed
app/services/rpa_service.py
@@ -1,13 +1,25 @@
1
-import pyautogui
2
import time
3
import logging
+import os
4
5
logger = logging.getLogger(__name__)
6
7
+# Handle headless environments where pyautogui might fail to import
8
+try:
9
+ import pyautogui
10
+ PYAUTOGUI_AVAILABLE = True
11
+except Exception as e:
12
+ logger.warning(f"pyautogui not available (likely headless environment): {e}")
13
+ PYAUTOGUI_AVAILABLE = False
14
+
15
def type_docstring(docstring: str):
16
"""
17
Uses pyautogui to ghost-type the docstring directly into the active editor.
18
19
+ if not PYAUTOGUI_AVAILABLE:
20
+ logger.error("RPA typing requested but pyautogui is not available.")
21
+ return
22
23
try:
24
# 1. Move to the end of the selection/line
25
# Pressing 'right' unselects highlighted text and puts cursor at end.
0 commit comments