Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Error with win32com client on windows 2003 server

Reply
Thread Tools

Error with win32com client on windows 2003 server

 
 
SPJ
Guest
Posts: n/a
 
      04-18-2008
Sorry, forgot to mention Subject in my earlier post, hence reposting.
------------
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
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("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)

I verified that installation is same. Any idea's as to what might be the problem? One thing I have noticed though is I can't see Microsoft office 11.0 object library when I do combrowse on windows 2003 server. I also to tried to reinstall python and windows extension. But still no luck.

I would appreciate if anyone can guide me as to why this is happening and how to resolve this.

Thanks,
SPJ


__________________________________________________ __________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i...Dypao8Wcj9tAcJ
 
Reply With Quote
 
 
 
 
Mike Driscoll
Guest
Posts: n/a
 
      04-18-2008
On Apr 18, 3:12 pm, SPJ <(E-Mail Removed)> wrote:
> Sorry, forgot to mention Subject in my earlier post, hence reposting.
> ------------
> 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
> 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("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)
>
> I verified that installation is same. Any idea's as to what might be the problem? One thing I have noticed though is I can't see Microsoft office 11.0 object library when I do combrowse on windows 2003 server. I also to tried to reinstall python and windows extension. But still no luck.
>
> I would appreciate if anyone can guide me as to why this is happening and how to resolve this.
>
> Thanks,
> SPJ
>
> __________________________________________________ __________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i...Dypao8Wcj9tAcJ



I would recommend that you re-post to the PyWin32 user's group. They
know the low-down on this stuff.

You can find them here: http://mail.python.org/mailman/listinfo/python-win32

However, if you cannot access the object library, than that's probably
the problem. I've no idea how to resolve that though. The gurus on the
group linked above would likely know however.

Mike
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
win32com.client.Dispatch - understanding error messages mirandacascade@yahoo.com Python 4 07-19-2006 04:16 AM
Distutils Error while building 'win32com.client' extension Math Python 0 02-26-2006 07:03 PM
Distutils Error while building 'win32com.client' extension Math Python 0 02-26-2006 07:00 PM
Windows server SBS cost less then Windows Server 2003 Steve Benson Computer Support 4 08-26-2005 05:29 PM
Windows 2003 Server or Exchange Server 2003 first????? Ozzie MCSA 1 11-30-2004 01:10 AM



Advertisments