ActivityWatch / activitywatch

The best free and open-source automated time tracker. Cross-platform, extensible, privacy-focused.
https://activitywatch.net/
Mozilla Public License 2.0
11.44k stars 521 forks source link

[Beta][Windows]: aw-watcher-window crashes constantly with "Module use of python39.dll conflicts with this version of Python" #936

Closed PetbkA closed 10 months ago

PetbkA commented 11 months ago

Describe the bug

  1. aw-watcher-window worked OK with AW 0.12.3b3 and Python 3.8.10 x64;
  2. Then I installed 0.12.3b7, and watcher have started to restart cyclically with the folowing error in log:
    2023-08-11 19:18:07 [ERROR]: Exception thrown while trying to get active window  (aw_watcher_window.main:124)
    Traceback (most recent call last):
    File "aw_watcher_window\main.py", line 106, in heartbeat_loop
    File "aw_watcher_window\lib.py", line 65, in get_current_window
    File "aw_watcher_window\lib.py", line 39, in get_current_window_windows
    File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
    File "aw_watcher_window\windows.py", line 6, in <module>
    ImportError: Module use of python39.dll conflicts with this version of Python.
  3. Tried to remove Python 3.8.10 x64 and install 3.11.4 x64 with the same result;
  4. Uninstalled 3.11.4, but the same was with Python 3.9.13 x64.

To Reproduce

  1. Install Python 3.8.10 x64 with adding it to PATH - OK;
  2. Install ActivityWatch 0.12.3b7 on 0.12.3b3 - OK;
  3. Check aw-watcher-window's logs for conflicts with this version of Python - NOK, constant errors are present, and watcher restarts continuosly.

Expected behavior

  1. There will be no conflicts with this version of Python in watcher's logs;
  2. Watcher will be working.

Documentation

Additional context

github-actions[bot] commented 11 months ago

Hi there! As you're new to this repo, please make sure you've used an appropriate issue template and searched for duplicates (it helps us focus on actual development!). We'd also like to suggest that you read our contribution guidelines and our code of conduct. Thanks a bunch for opening your first issue! 🙏

ErikBjare commented 11 months ago

Thank you for reporting this!

I probably messed up something with the merge of:

I will investigate, thank you for a detailed report :)

ErikBjare commented 11 months ago

@BelKed This is the kind of "real-life testing" I was referring to in #931 :sweat_smile:

Do you have any idea what could be the culprit here? I'm not sure where to begin.

ErikBjare commented 11 months ago

Alright, I've taken a look and found that we were using some ancient version of pywin32, which I fixed.

I don't have a Windows machine handy to validate the fix, so I'm releasing a new v0.12.3b8 which someone can hopefully validate works.

ErikBjare commented 11 months ago

You can now try the new v0.12.3b8: https://github.com/ActivityWatch/activitywatch/releases/tag/v0.12.3b8

PetbkA commented 11 months ago

0.12.3b6 x64 → 0.12.3b8 x64 + Python 3.8.10 x64 - window watcher doesn't crash but:

  1. It still doesn't work;
  2. conflicts with this version of Python errors are still cyclical, although in other flavour:
    2023-08-17 18:32:26 [INFO ]: aw-watcher-window started  (aw_watcher_window.main:62)
    2023-08-17 18:32:27 [INFO ]: Connection to aw-server established by aw-watcher-window  (aw_client.client:436)
    2023-08-17 18:32:28 [ERROR]: Exception thrown while trying to get active window  (aw_watcher_window.main:124)
    Traceback (most recent call last):
    File "aw_watcher_window\main.py", line 106, in heartbeat_loop
    File "aw_watcher_window\lib.py", line 65, in get_current_window
    File "aw_watcher_window\lib.py", line 39, in get_current_window_windows
    File "PyInstaller\loader\pyimod02_importers.py", line 385, in exec_module
    File "aw_watcher_window\windows.py", line 6, in <module>
    ImportError: Module use of python39.dll conflicts with this version of Python.
PetbkA commented 10 months ago

0.12.3b6 x64 → 0.12.3b9 x64 + Python 3.8.10 x64 - seems fixed

ErikBjare commented 10 months ago

@PetbkA Thanks for validating!