question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception thrown while trying to get active window - WINDOWS

See original GitHub issue
  • [ 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.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jparrish88commented, Oct 16, 2022

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:

  1. Open Admin CMD Prompt (Not powershell), that will drop you into Windows\System32\
  2. cd wbem
  3. dir /b *.mof *.mfl | findstr /v /i uninstall > moflist.txt & for /F %s in (moflist.txt) do mofcomp %s
  4. Open WMIMGMT.MSC
  5. Ensure the system connects to WMI management

Thanks to everyone who helped me: @ShootingKing-AM @mminer237 @ErikBjare

1reaction
ErikBjarecommented, Oct 16, 2022

Yay! Happy we could get to the bottom of this 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception thrown while trying to get active window · Issue #742
I am on the latest ActivityWatch version. I have searched the issues of this repo and believe that this is not a duplicate....
Read more >
Exception thrown while trying to get active window: error ...
I'm new here and trying to get AW working on my Mac (OS 10.14.6). The AW server is up and running, and I've...
Read more >
Manage exceptions with the debugger in Visual Studio
Tell the debugger to break when an exception is thrown​​ In the Exception Settings window (Debug > Windows > Exception Settings), expand the...
Read more >
OpenGL Exception thrown: read access violation, window was ...
The exception says the following:- Exception thrown: read access violation. window was 0xCCCCCCCC. It happens in the window.c file of GLFW ...
Read more >
502544 – IllegalStateException "Application does not have an ...
Summary: IllegalStateException "Application does not have an active window" when attem... Status: RESOLVED FIXED.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found