I wrote a script in python to open and run an alteryx workflow, and used Windows task scheduler to automate it daily. It works great when I'm connected to the VM from my laptop. But when I let it run while the VM is disconnected from my laptop, it opens alteryx but doesn't run the workflow.
Python Script
import pyautogui as pg
import os
import time
time.sleep(10)
os.startfile("C:\\Users\\my_name\\Desktop\\Python Test Workflow.yxmd")
time.sleep(45) #build in enough time for Alteryx to open the workflow
pg.hotkey('ctrl', 'r')
time.sleep(10)
Batch file executed by task scheduler
"C:\Program Files\Python39\python.exe" "C:\Users\my_name\Desktop\Python Alteryx Getv2\Getv2_Refresh_Py_Script.py"
pause
Error Message in cmd.exe
C:\Windows\system32>"C:\Program Files\Python39\python.exe" "C:\Users\my_name\Desktop\Python Alteryx Getv2\Getv2_Refresh_Py_Script.py"
Traceback (most recent call last):
File "C:\Users\my_name\Desktop\Python Alteryx Getv2\Getv2_Refresh_Py_Script.py", line 8, in <module>
pg.hotkey('ctrl', 'r')
File "C:\Users\my_name\AppData\Roaming\Python\Python39\site-packages\pyautogui\__init__.py", line 597, in wrapper
failSafeCheck()
File "C:\Users\my_name\AppData\Roaming\Python\Python39\site-packages\pyautogui\__init__.py", line 1722, 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.
C:\Windows\system32>pause
Press any key to continue . . .