Re:

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tim Golden

    Re:

    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("Exce l.Application", "Quit")
    workbook = excel.Workbooks .Open(xlsfile)
    workbook.SaveAs (csvfile, FileFormat=24) # 24 represents xlCSVMSDOS
    workbook.Close( False)
    excel.Quit()
    >
    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("Exce l.Application", "Quit")
    File "D:\Python25\Li b\site-packages\win32c om\client\__ini t__.py", line 95, in Dispatch
    dispatch, userName = dynamic._GetGoo dDispatchAndUse rName(dispatch, userName,clsctx )
    File "D:\Python25\li b\site-packages\win32c om\client\dynam ic.py", line 98, in _GetGoodDispatc hAndUserName
    return (_GetGoodDispat ch(IDispatch, clsctx), userName)
    File "D:\Python25\li b\site-packages\win32c om\client\dynam ic.py", line 78, in _GetGoodDispatc h
    IDispatch = pythoncom.CoCre ateInstance(IDi spatch, None, clsctx, pythoncom.IID_I Dispatch)
    com_error: (-2147221005, 'Invalid class string', None, None)
    What's that "Quit" doing as the second param to Dispatch?

    TJG
Working...