pyhon error, pyautogui

Asked

Viewed 223 times

0

I created a bot(macro) which has the function of making a few clicks in X time. I made the loop for this.

def afkLoop(): #Loop
    pycontrol.broken() #Função
    time.sleep(1800) #Timer
    afkLoop() 

def broken(): #Função
    print "["+(str(time.strftime("%H:%M:%S")))+"] Done.."

    pyautogui.click(104,14) #Aba 01
    time.sleep(3)
    pyautogui.press("up")
    pyautogui.press("down")

    time.sleep(3)    
    pyautogui.click(297,17) #Aba 02
    time.sleep(3)
    pyautogui.press("up")
    pyautogui.press("down")

    time.sleep(3)    
    pyautogui.click(475,11) #Aba 03
    time.sleep(3)
    pyautogui.press("up")
    pyautogui.press("down")

    time.sleep(3)    
    pyautogui.click(659,16) #Aba 04
    time.sleep(3)
    pyautogui.press("up")
    pyautogui.press("down")

The problem, is that of a few hours, the program closes, I managed to catch the error: pyautogui.Failsafeexception: Pyautogui fail-safe Triggered from mouse Moving to upper-left. To disable this fail-safe, set pyautogui.FAILSAFE to False.

How can I fix it? I’m using python 2.7 and pyautogui.

  • "To disable this fail-safe, set pyautogui.FAILSAFE to False." Where should I disable this? how?

  • 1

    If you can read English, you have documentation

  • Got it, thank you :D

1 answer

0


As a security feature, a fault protection feature is enabled by default. When the Pyautogui functions increase, if the mouse cursor is in the upper left corner of the screen. If you lose control and need to stop the current Pyautogui function, continue moving the mouse cursor up and left. To disable this feature, configure to:

pyautogui.FAILSAFE = False 

Learn more in http://pyautogui.readthedocs.io/en/latest/introduction.html#fail-safes

Browser other questions tagged

You are not signed in. Login or sign up in order to post.