mhammond / pywin32

Python for Windows (pywin32) Extensions
5.07k stars 799 forks source link

ImportError in PyWin32 v307 on axdebug from pywin32_postinstall #2387

Closed segevfiner closed 1 month ago

segevfiner commented 1 month ago

For all bugs, please provide the following information:

Expected behavior and actual behavior

python pywin32_install.py -install should complete cleanly.

Steps to reproduce the problem

  1. Run python $env:LOCALAPPDATA\Programs\Python\Python312\Scripts\pywin32_postinstall.py -install
Parsed arguments are: Namespace(install=True, remove=False, wait=None, silent=False, quiet=False, destination='C:\\Users\\Segev\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages')
Copied pythoncom312.dll to C:\WINDOWS\system32\pythoncom312.dll
Copied pywintypes312.dll to C:\WINDOWS\system32\pywintypes312.dll
Registered: Python.Interpreter
Registered: Python.Dictionary
FAILED to register the Python COM objects
Traceback (most recent call last):
  File "C:\Users\Segev\AppData\Local\Programs\Python\Python312\Scripts\pywin32_postinstall.py", line 495, in install
    RegisterCOMObjects()
  File "C:\Users\Segev\AppData\Local\Programs\Python\Python312\Scripts\pywin32_postinstall.py", line 243, in RegisterCOMObjects
    __import__(module)
  File "C:\Users\Segev\AppData\Local\Programs\Python\Python312\Lib\site-packages\win32comext\axscript\client\pyscript.py", line 20, in <module>
    from win32com.axscript.client import framework, scriptdispatch
  File "C:\Users\Segev\AppData\Local\Programs\Python\Python312\Lib\site-packages\win32comext\axscript\client\framework.py", line 37, in <module>
    from . import error  # ax.client.error
    ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Segev\AppData\Local\Programs\Python\Python312\Lib\site-packages\win32comext\axscript\client\error.py", line 19, in <module>
    from win32comext.axscript.client.debug import DebugManager
  File "C:\Users\Segev\AppData\Local\Programs\Python\Python312\Lib\site-packages\win32comext\axscript\client\debug.py", line 8, in <module>
    from win32com.axdebug import adb, axdebug, documents, gateways
  File "C:\Users\Segev\AppData\Local\Programs\Python\Python312\Lib\site-packages\win32comext\axdebug\adb.py", line 15, in <module>
    from . import axdebug, gateways, stackframe
  File "C:\Users\Segev\AppData\Local\Programs\Python\Python312\Lib\site-packages\win32comext\axdebug\gateways.py", line 6, in <module>
    from win32com.axdebug import axdebug
ImportError: cannot import name 'axdebug' from 'win32com.axdebug' (C:\Users\Segev\AppData\Local\Programs\Python\Python312\Lib\site-packages\win32comext\axdebug\__init__.py)
NOTE: PyWin32.chm can not be located, so has not been registered
Registered help file
Pythonwin has been registered in context menu
Creating directory C:\Users\Segev\AppData\Local\Programs\Python\Python312\Lib\site-packages\win32com\gen_py
Shortcut for Pythonwin created
The pywin32 extensions were successfully installed.

System information

Python version and distribution: Offical 3.12.7 amd64

pywin32 version: 307

Installed from PyPI or exe installer: PyPI via pip

Windows Version: 10.0.22631.4169

DLL locations:

C:\Users\Segev\AppData\Local\Programs\Python\Python312\Lib\site-packages\pywin32_system32\pywintypes312.dll
C:\Users\Segev\AppData\Local\Programs\Python\Python312\Lib\site-packages\pywin32_system32\pythoncom312.dll
Avasam commented 1 month ago

I'll leave this issue open until the next release, but it should be fixed by #2381

mhammond commented 1 month ago

We should maybe see if we can run that postinstall script in CI?

Avasam commented 1 month ago

Fixed by https://github.com/mhammond/pywin32/pull/2381 (released in 308)