Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'NoneType' object is not subscriptable #21

Open
m-jonas opened this issue Apr 4, 2024 · 3 comments · May be fixed by #22
Open

TypeError: 'NoneType' object is not subscriptable #21

m-jonas opened this issue Apr 4, 2024 · 3 comments · May be fixed by #22
Assignees

Comments

@m-jonas
Copy link

m-jonas commented Apr 4, 2024

Hi,

First of all let me tell you - I love your work, this tool is brilliant!

I am having an error when running following command: python.exe .\keep-presence.py -s 30 -p 5 -m both -c on Windows 11, using Python 3.10 and running 'main' branch code which is identical with v1.0.7 tag.

10:20:49 User activity detected
--------
10:21:19 Idle detection
Traceback (most recent call last):
  File "C:\Users\XXXX\OneDrive - XXXX\Documents\repositories\keep-presence\src\keep-presence.py", line 175, in <module>
    execute_keep_awake_action()
  File "C:\Users\XXX\OneDrive - XXXX\Documents\repositories\keep-presence\src\keep-presence.py", line 157, in execute_keep_awake_action
    move_mouse()
  File "C:\Users\XXXX\OneDrive - XXXX\Documents\repositories\keep-presence\src\keep-presence.py", line 121, in move_mouse
    new_x = currentPosition[0] + delta_x
TypeError: 'NoneType' object is not subscriptable

It happens only when I lock my computer with CTRL+ALT+DEL. Otherwise it switches between active and idle just fine:

image

I am experimenting with currentPosition indices at line 121, as per error, at this time, but perhaps you can offer a better insight into the problem and/or a fix.

Thanks!

Jonas

@m-jonas
Copy link
Author

m-jonas commented Apr 4, 2024

Just to add some more insight from further experimentation: using arg -m keyboard after locking the screen works just fine, no errors. So must be something to do with mouse when Windows is locked.

@carrot69 carrot69 self-assigned this Apr 5, 2024
@carrot69 carrot69 linked a pull request Apr 5, 2024 that will close this issue
@carrot69
Copy link
Owner

carrot69 commented Apr 5, 2024

Hey @m-jonas! I'm happy that you're enjoying this tool!

Unfortunately, I don't have Windows at the moment. However, I've just created a pull request that I believe addresses your issue. Would you be willing to give it a try?

Please keep me updated. If the pull request resolves your issue, I'll merge it into the master branch.

Thank you!

@m-jonas
Copy link
Author

m-jonas commented Apr 9, 2024

Hi @carrot69

Just tried, got the same error. Posted it in the PR discussion.

Regards

Jonas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants