ActivityWatch / activitywatch

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

DLL load failed while importing pythoncom: pyi_rth_win32comgenpy #804

Open BenjaminSymons opened 2 years ago

BenjaminSymons commented 2 years ago

Describe the bug

aw-qt binary fails to properly launch the application; am immediately met with an unhandled exception in script. This happens when the program is installed and run or if launched from the extracted zip file. Potential exe build error?

To Reproduce

1. Install or download and unzip the latest release for windows
2. Run aw-qt.exe
3. See error

Expected behavior

The application launches successfully

Documentation

Traceback (most recent call last):
  File "Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_win32comgenpy.py", line 52, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "win32com\__init__.py", line 6, in <module>
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "pythoncom.py", line 4, in <module>
  File "pywintypes.py", line 118, in __import_pywin32_system_module__
ImportError: DLL load failed while importing pythoncom: The specified procedure could not be found.

Additional context

Program never properly launches so there are no log files to attach

SzilvasiPeter commented 1 year ago

Hi, this problem occurs when multiple different pywintypes and pythoncom DLL exists. For example, if you have pywin32 in anaconda and in python environment then the different versions will collide.

Reinstall the pywin32

  1. Uninstall pywin32 everywhere: conda uninstall pywin32, pip uninstall pywinXX
  2. Remove DLLs everywhere: Search for "pythoncomXX.dll" and "pywintypesXX.dll" in the anaconda, python and C:\Windows\System32 locations. Note: Replace XX with your python version.
  3. Install pywin32: Use conda OR pip for install
  4. Register COM objects: python Scripts/pywin32_postinstall.py -install