pyautocad icon indicating copy to clipboard operation
pyautocad copied to clipboard

_ctypes.COMError

Open YU6326 opened this issue 7 years ago • 2 comments

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))

YU6326 avatar Oct 20 '17 10:10 YU6326

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

  • macOS Mojave 10.14.5
  • Python 3.7.2 running in virtualenv.
  • pip 19.1.1.

zacharynevin avatar May 22 '19 21:05 zacharynevin

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

autokludge avatar Dec 23 '19 01:12 autokludge