From: Thomas H. <th...@ct...> - 2008-04-03 18:20:23
|
Kelie schrieb: > Hello group, > > I'm getting an error when trying to launch AutoCAD using comtypes. The > application does get started. But the variable 'app' does not seem to hold a > valid instance of it, because I was not able to access its properties such as > ActiveDocument, WindowState, etc.. > > This is copied from Python shell: > >>>> import comtypes >>>> comtypes.__version__ > '0.4.2' >>>> app = comtypes.client.CreateObject("AutoCAD.Application") > # Generating comtypes.gen.AutoCAD > Traceback (most recent call last): > File "<interactive input>", line 1, in <module> > File "C:\Programming\Python\Install\comtypes\comtypes\client\__init__.py", > line 202, in CreateObject > return _manage(obj, clsid, interface=interface) > File "C:\Programming\Python\Install\comtypes\comtypes\client\__init__.py", > line 170, in _manage > obj = GetBestInterface(obj) > File "C:\Programming\Python\Install\comtypes\comtypes\client\__init__.py", > line 133, in GetBestInterface > interface = getattr(mod, itf_name) > AttributeError: 'module' object has no attribute 'IAcadApplication' > > Any idea why? > > (btw, if I remember correctly, I didn't used to get this error. But I was using > an earlier version comtypes and an earlier version of AutoCAD.) You should remove *all* the files in the comtyes\gen directory and try again. Thomas |