Problem with Pywin32 on Windows 7, Python 3.1.1

Hello, I was just looking for someone who could help me out: I’ve installed Pywin32 batch 214 for Python 3.1, I give it the simple command of

>>> import win32com.client
>>> win32com.client.Dispatch(dispatch=“Word.Application”)

and I get a long error message:

Traceback (most recent call last):
File “<interactive input>”, line 1, in <module>
File “C:\Python31\lib\site-packages\win32com\client_init_.py”, line 95, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File “C:\Python31\lib\site-packages\win32com\client\dynamic.py”, line 104, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File “C:\Python31\lib\site-packages\win32com\client\dynamic.py”, line 84, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221005, ‘Invalid class string’, None, None)

I’m not sure if this is relevant, but I only have Openoffice installed, not any Windows Office, does it even matter?

Thanks for the help!

Hello All,

I have used Adam’s code to try my hands on in using python in case of PSD
I need a tool to compare two psd files and give difference of both (layer width/height mismatch etc)

To start with ,I am using below piece of code to read through a psd file.A partial code chunk is printed below:

if (name == ‘main’):
# COM dispatch for Photoshop
psApp = win32com.client.Dispatch(‘Photoshop.Application’)
options = win32com.client.Dispatch(‘Photoshop.ExportOptionsSaveForWeb’)

Error:
pywintypes.com_error: (-2147221005, ‘Invalid class string’, None, None)

Any suggestions?

You can try use the code described here to get more info on the error: