471,054 Members | 1,651 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,054 software developers and data experts.


SPJ wrote:
I am writing a script which need's to convert an excel file to
csv (text) format. For that I am using the following code:

excel = win32com.client.Dispatch("Excel.Application","Quit ")
workbook = excel.Workbooks.Open(xlsfile)
workbook.SaveAs(csvfile, FileFormat=24) # 24 represents xlCSVMSDOS

I did not have any problem running this script on a windows xp
machine with python 2.5.2 and windows extensions.
But I get the following error when I run the same script on a
windows 2003 server with the same python and windows extension installation:
excel = win32com.client.Dispatch("Excel.Application","Quit ")
File "D:\Python25\Lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userN ame,clsctx)
File "D:\Python25\lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "D:\Python25\lib\site-packages\win32com\client\dynamic.py", line 78, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
com_error: (-2147221005, 'Invalid class string', None, None)
What's that "Quit" doing as the second param to Dispatch?

Jun 27 '08 #1
0 859

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.