Skip to content

Commit 1b4ff48

Browse files
committed
Fix : RPA Service updated
1 parent 3cf221c commit 1b4ff48

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

app/services/rpa_service.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
1-
import pyautogui
21
import time
32
import logging
3+
import os
44

55
logger = logging.getLogger(__name__)
66

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+
715
def type_docstring(docstring: str):
816
"""
917
Uses pyautogui to ghost-type the docstring directly into the active editor.
1018
"""
19+
if not PYAUTOGUI_AVAILABLE:
20+
logger.error("RPA typing requested but pyautogui is not available.")
21+
return
22+
1123
try:
1224
# 1. Move to the end of the selection/line
1325
# Pressing 'right' unselects highlighted text and puts cursor at end.

0 commit comments

Comments
 (0)