python - Win32com not dispatching excel, saying 'Server execution failed' -


my initial script is:

import win32com.client import os  file1= r'c:\\users\cevans\desktop\models1\file.xlsm'  def refresher():     if os.path.exists(file1):         xl = win32com.client.dispatch("excel.application")         xl.workbooks.open(filename=file1,readonly=1)         xl.visible = true         xl.application.run('report_tablerefresh1')         xl.workbooks(1).close(savechanges=1)         xl.application.quit()         del xl refresher() 

i getting error when trying simple dispatch of excel, oddly script had been running fine few weeks error popped up. suggestions?

traceback (most recent call last):   file     "c:/users/cevans/pycharmprojects/riglocatormappull/pipe_storagerefresh.py",     line 17, in <module>     refresher()   file     "c:/users/cevans/pycharmprojects/riglocatormappull/pipe_storagerefresh.py", l    ine 10, in refresher     xl = win32com.client.dispatch("excel.application")    file "c:\python27\lib\site-packages\win32com\client\__init__.py", line 95, in dispatch     dispatch, username = dynamic._getgooddispatchandusername(dispatch,username,clsctx)   file "c:\python27\lib\site-packages\win32com\client\dynamic.py", line 104, in _getgooddispatchandusername return (_getgooddispatch(idispatch, clsctx), username)   file "c:\python27\lib\site-packages\win32com\client\dynamic.py", line 84, in _getgooddispatch     idispatch = pythoncom.cocreateinstance(idispatch, none, clsctx, pythoncom.iid_idispatch) pywintypes.com_error: (-2146959355, 'server execution failed', none, none) 

one solution reboot windows os (doing complete reinstall) there appeared error windows os registry excel. found cause of other 'server execution failed' type errors using win32com.


Popular posts from this blog

debugging - Reference - What does this error mean in PHP? -