How can pyautogui be made to work when using an RDP?

Viewed 222

I am using pyautogui on a RDP with Windows 10 and Python 3 loaded but when I run pyautogui with the RDP minimised, I receive the following error message:

Traceback (most recent call last):
  File "C:/Users/Administrator/PycharmProjects/MyProject- Copy/main.py", line 40, in <module>
    funks.post_video(title,filepath)
  File "C:\Users\Administrator\PycharmProjects\MyProject- Copy\funks.py", line 10, in post_video
    pyautogui.click(1317, 56)
  File "C:\Users\Administrator\PycharmProjects\TEST\venv\lib\site-packages\pyautogui\__init__.py", line 585, in wrapper
    failSafeCheck()
  File "C:\Users\Administrator\PycharmProjects\TEST\venv\lib\site-packages\pyautogui\__init__.py", line 1710, in failSafeCheck
    raise FailSafeException(
pyautogui.FailSafeException: PyAutoGUI fail-safe triggered from mouse moving to a corner of the screen. To disable this fail-safe, set pyautogui.FAILSAFE to False. DISABLING FAIL-SAFE IS NOT RECOMMENDED.

It recommends setting pyautogui.FAILSAFE = False, but this doesn't help either (pyautogui has no error message but it doesn't do anything)

After some digging it seems the issue is that Windows stops outputting the display when you exit the remote desktop session (I'd assume to save memory or something). Because the remote PC is no longer outputting a display, PyAutoGUI has nothing to actually interact with.

Would anyone have any workaround to this? Perhaps some configuration to trick the RDP into continuing to output a display even when the RDP is minimized?

0 Answers
Related