Pywintypes.com_error

,

Hello, i have mysterious problem with a “cameraserver” tool i’ve recently written.
Its a python(2.6/32bit) script that uses maxscript over COM, Qt, PyQt-Py2.6-gpl-4.7.5-1, pywin32-214.win32, MySQL-python-1.2.3b2.win32 and I’ve used py2exe-0.6.9.win32 to make an executable out of it.
It runs perfectly on my win7pro-64bit and 6 of our newer win7pro-64bit render farm systems(which i used for testing). It requires max 2009 to be running, I keep the latest build on our SAN and run it from shortcuts on the test systems. This was all is fine and i was happy and was looking forward to expand it into a really simple asset management tool.
Well turns out things arent working on win7 artist, other farm win7 or winXP computers and the error i get is:


Traceback (most recent call last):
  File "CameraServer.py", line 3, in <module>
  File "CameraOps.pyc", line 7, in <module>
  File "CameraOps.pyc", line 17, in CamOps
  File "win32com\client\__init__.pyc", line 95, in Dispatch
  File "win32com\client\dynamic.pyc", line 104, in _GetGoodDispatchAndUserName
  File "win32com\client\dynamic.pyc", line 84, in _GetGoodDispatch
pywintypes.com_error: (-2147221164, 'Class not registered', None, None)

Which suggest a problem with COM registering(i think) and from what i’ve gathered about this error from different sources is that this is an 64bit issue.
All of our win7/winxp are 64bit. However, my python is 32bit and so are all of the site packages. Ive looked into the COM registering on these computers and mxs gives no errors and the registry keys are there and intact. We use comodo for antivirus and i get noticed by it on my system but that doesnt matter, it still works after an exception is added.
I’ve just recently begun python work (did some realflow tools a year ago tho) and i must say im at a loss to explain this…
All help is greatly appreciated.

Hi,

Here are my 2 cents.
The error you are getting is definitely from COM but it could come from many different places. I have also created a simple tool, just a proof of concept for a new pipeline I am working on which syncs motion builder and max via COM/Telnet.
1 of the issues i had was compiling the exe on win7 64 and running it in other OS. I solved that by compiling it on WinXP 32 and distributing that executable.
I also had some issues with Max methods not registered properly and I came up with a startup script that works fine, made out of bits and pieces from some other people’s scripts and adding my own stuff in it. If you want to have a look you can download the tool here: http://rubenhenares.404fs.com/tools/mobu-2-max/
Once installed go to the installation directory and you will find a folder called “max” where you can find the startup script which should indeed be copied to your max/scripts/startup folder.
Could be also caused by the UAC (User account control) of Windows 7. We have had some isses here at Ubisoft with that. I assume you have already disabled it.

I think i am not of great help but that’s all i can say :slight_smile:

Best,
Ruben Henares.

[QUOTE=swat3d;8266]
Could be also caused by the UAC (User account control) of Windows 7. We have had some isses here at Ubisoft with that. I assume you have already disabled it.
[/QUOTE]
I had run into com registration problems with 3dsmax not being run as administrator but didnt think of running my app the same way, duh.
turning off UAC actually made it work on all systems running win7! :slight_smile: So thanks a lot!
Now all i have to do i figure out howto make it run on xp (building it on xp makes sense)… or maybe ill just wait until we update everything to win7 soon.

Oh and that mb2max looks very nifty indeed :slight_smile:
Made me think of this rPyC thing i saw (something ill be looking into soon)
Thanks again!

UAC, everyone’s best friend. It silently halts any COM connections between trusted and non-trusted apps. It’s pretty great like that.