St.cache_resource() has a problem when it comes to caching applications

Hi Everyone! I am trying to create an instance of Excel and cache it so that when I need to open Excel files, I don’t have to wait for long time for Excel to launch. The problem is that it is very unstable. Sometimes it runs with no problem, but sometimes I get the error that says: com_error: (-2147220995, ‘Object is not connected to server’, None, None). Here is my Code:

import xlwings as xw

@st.cache_resource()
def dispatch_excel(self):
excel = xw.App(visible=False)
return excel

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.