activitywatch: Exception thrown while trying to get active window - WINDOWS
- [ x ] I am on the latest ActivityWatch version.
- [ x ] I have searched the issues of this repo and believe that this is not a duplicate.
- OS name and version: Windows 10 Pro 21H2
- ActivityWatch version: 0.12.1
-
- There is one that is similar, but it is for MacOS, and I checked through multiple bug reports and didn’t seem to find something that applies. The fix seems to be use the latest binary (of course, I tried that).
Describe the bug
The AW window watcher seems to be throwing exceptions all the time. This is from the top of the log, but the main exception, below in the log, is replicated hundreds of times.
To Reproduce
Removed installed Activity watch components in both AppData/Local and AppData/Local/Programs. Reinstalled with both ADMIN and regular user authority. Checked the box to start AW. AW seems to start, but no window titles are reported, graphs don’t display, etc. Checked logs for AW window watcher and can see the below logs
Expected behavior
The expected behavior is to see window titles both in the log and in the program.
Documentation
2022-10-10 14:40:43 [INFO ]: aw-watcher-window started (aw_watcher_window.main:62) 2022-10-10 14:40:45 [INFO ]: Connection to aw-server established by aw-watcher-window (aw_client.client:429) 2022-10-10 14:40:45 [ERROR]: Exception thrown while trying to get active window (aw_watcher_window.main:110) Traceback (most recent call last): File “aw_watcher_window\main.py”, line 107, in heartbeat_loop File “aw_watcher_window\lib.py”, line 57, in get_current_window File “aw_watcher_window\lib.py”, line 40, in get_current_window_windows File “aw_watcher_window\windows.py”, line 26, in get_app_name File “wmi.py”, line 1072, in query File “wmi.py”, line 1072, in <listcomp> File “win32com\client\dynamic.py”, line 324, in getitem File “win32com\client\util.py”, line 41, in getitem File “win32com\client\util.py”, line 62, in __GetIndex pywintypes.com_error: (-2147217392, ‘OLE error 0x80041010’, None, None)
Additional context
This is one of my favorite programs. So thank you so much for any help. I’ve used this program for a long time. All of sudden without any changes in my software setup, the Window Watcher seemed to be showing UNKNOWN for everything. I couldn’t figure out a way to fix that. Now however, nothing seems to be working to get the window titles back.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 15 (3 by maintainers)
Hi All, @ErikBjare suggestion worked. I followed the instructions here after seeing that the WMI services were invalid. I apologize for wasting everyone’s time. The steps I took to resolve this are very similar to the article, but basically I executed:
Thanks to everyone who helped me: @ShootingKing-AM @mminer237 @ErikBjare
Yay! Happy we could get to the bottom of this 😃
Actually, sorry, I’m getting error 0x80041017 instead, but every other line in the error is the same. This is probably a separate thing.
Restarting the window watcher usually fixes it for it me and actually makes the missing window entries appear.
It looks like I got it before upgrading too, but it just didn’t stop all entries from showing up thereafter before.
It looks like 0x80041010 means “Invalid WMI class” and 0x80041017 means “Invalid WMI query”. Presumably, pid must not be getting set for me. I’m not sure what invalid WMI class could be caused by.