Well, we’re at it again. While I had no problem getting it to work at home, I finally got a SysAdmin at work to run the scripts and we got some errors. He ran the Maxscript fine (to register Max), but when trying to run the Python code, it complained about a class not being registered.
#Create a connection to Max
conn = win32com.client.Dispatch("MAX.Application.8")
Traceback (most recent call last):
File "path o\callingmaxsc.py", line 6, in ?
con = win32com.client.Dispatch("MAX.Application.8")
File "C:\Python24\lib\site-packages\win32com\client\dynamic.py", line 95, in Dispatch
dispatch, username = dynamic._GetGoodDispatchAndUserName(dispatch, username, clsctx)
File "C:\Python24\lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName
return (_GetGoodDispatchAndUserName(IDispatch, clsctx), userName)
File "C:\Python24\lib\site-packages\win32com\client\dynamic.py", line 78, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
com_error: (-2147221164, 'Class not registered', None, None)
This was run by the Admin. We looked at the registry, and all the keys and values looked good. Setup: Max 8, Python 2.4.3 with pywin32, XP 64 SP2.
I got it to work at home with XP SP3, Python 2.5 and pywin32, Max 2009. I will try, when I get home, to use an older version of Python and Max, to see if I can reproduce the problem. I also tried using comtypes since I had some issues with win32com, but I get the same errors, so it has something to do with the classes in the register not being found…
Anyone who encountered this problem? I will try to post again before the weekend to see if I can reproduce this at home with older versions of Max and Python.