reclosedev / pyautocad

AutoCAD Automation for Python ⛺
http://pypi.python.org/pypi/pyautocad/
BSD 2-Clause "Simplified" License
506 stars 143 forks source link

_ctypes.COMError #17

Open YU6326 opened 7 years ago

YU6326 commented 7 years ago

when type the example:

for obj in acad.iter_objects():
    print obj.ObjectName

a bug occurred Traceback (most recent call last): File "<pyshell#10>", line 1, in for obj in acad.iter_objects(): File "C:\Program Files\Python36\lib\site-packages\pyautocad\api.py", line 128, in iter_objects item = self.best_interface(item) File "C:\Program Files\Python36\lib\site-packages\pyautocad\api.py", line 156, in best_interface return comtypes.client.GetBestInterface(obj) File "C:\Program Files\Python36\lib\site-packages\comtypes\client__init__.py", line 126, in GetBestInterface result = punk.QueryInterface(interface) File "C:\Program Files\Python36\lib\site-packages\comtypes\client\lazybind.py", line 142, in QueryInterface return self._comobj.QueryInterface(*args) File "C:\Program Files\Python36\lib\site-packages\comtypes__init.py", line 1156, in QueryInterface self.com_QueryInterface(byref(iid), byref(p)) _ctypes.COMError: (-2147467262, '不支持此接口', (None, None, None, 0, None))

zacharynevin commented 5 years ago

I'm getting the same thing. My system specs are:

autokludge commented 4 years ago

I worked around this issue by removing old versions of acaxenu.tlb and axdbenu.tlb from "C:\Program Files\Common Files\Autodesk Shared".

Eg. I'm currently running Autocad 2020, therefore please ensure only acax23enu.tlb and axdb23enu.tlb are available.

Relevant area of code is api.py lines 22-28