DEV Community

Saoni Deb
Saoni Deb

Posted on

Mouse Auto Click Script

Last year I faced this Google Colab issue wherein during my model training time(which took over 6 hours), my notebook kept disconnecting due to inactivity.
Wrote this small script to keep my session and in turn my system active.

from pynput.mouse import Button, Controller
import time

mouse = Controller()

while True:
    mouse.click(Button.left, 1)
    time.sleep(30)
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
alektomalee profile image
Alek Tomaich

where do I put this?