carrot69 / keep-presence

Keeps your computer awake by moving the mouse or pressing a key when you step away.
Creative Commons Zero v1.0 Universal
261 stars 39 forks source link

Run-time failure: TypeError: 'NoneType' object is not subscriptable #17

Closed yurivict closed 1 year ago

yurivict commented 1 year ago

keep-presence failed on Windows after some number of iterations:

16:22:22 User activity detected
--------                                                                                                                
16:24:02 Idle detection                                                                                                 
Traceback (most recent call last):                                                                                        
  File "C:\Users\<user>\keep-presence.py", line 160, in <module>                                                            
    execute_keep_awake_action()                                                                                           
  File "C:\Users\<user>\keep-presence.py", line 145, in execute_keep_awake_action                                           
    move_mouse()                                                                                                          
  File "C:\Users\<user>\keep-presence.py", line 114, in move_mouse
    new_x = currentPosition[0] + delta_x                                                                                            
            ~~~~~~~~~~~~~~~^^^                                                                                          
TypeError: 'NoneType' object is not subscriptable            

It never failed like this on FreeBSD for me.

carrot69 commented 1 year ago

Hi there! I have not tested Keep-Presence on Windows, but it should work as Pynput is compatible with Windows. If you find a solution, please create a pull request with it. I would be very grateful.

Anyways, this program is not intended to be used in Windows, since there's a lot of solutions like this for that OS.