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?
Hm, the exception seems to be raised when the module is generated. Please look into the comtypes\gen directory, do you find a (valid) AutoCAD.py file, and the file that is imported by AutoCad.py? If so, can you please look into the latter if there is a 'IAcadApplication' interface defined? If not, you should probably set a breakpoint on line 132 in comtypes\client\__init__.py, and inspect the generated module (which has not yet been written to disk). Or put a line print dir(mod) must before line 133 in this file. This should provide some insight. Thomas ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ comtypes-users mailing list comtypes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/comtypes-users