I am working on a Python script that interacts with a COM object of Autodesk Inventor. I can create this object like so:
>>> import win32com.client
>>> win32com.client.Dispatch('Inventor.Application')
When I am running it normally, it works fine. However, when I run it in a shell with admin permissions I get this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221164, 'Class not registered', None, None)
To try to find the cause of this issue, I followed the steps detailed here. I created this VB Script,
set obj = CreateObject("Inventor.Application")
MsgBox TypeName(obj)
And ran it with both 32 and 64 bit engines under varying permissions:
- User permissions- Script runs correctly both times
- Admin permissions- Script throws error both times
I also checked HKEY_CLASSES_ROOT
in my registry, and the application is there and spelled correctly. How can I resolve this?