INFO | program.py | 34 | 13-01-2023 05:47 +0100 | The network connection could not be found.
More help is available by typing NET HELPMSG 2250.
INFO | program.py | 39 | 13-01-2023 05:47 +0100 | The command completed successfully.
INFO | program.py | 47 | 13-01-2023 05:47 +0100 | Connection to MS Access DB successfull
INFO | program.py | 55 | 13-01-2023 05:47 +0100 | Fetched rows from MS Access DB
INFO | program.py | 60 | 13-01-2023 05:47 +0100 | Closed MS Access DB Connection
INFO | program.py | 79 | 13-01-2023 05:47 +0100 | Executing VBScript with source file: source.xls & destination file: dest.xlsm
ERROR | program.py | 109 | 13-01-2023 05:47 +0100 | Error Occured
ERROR | program.py | 110 | 13-01-2023 05:47 +0100 | (-2147352567, 'Exception occurred.', (0, 'Microsoft Excel', 'Open method of Workbooks class failed', 'xlmain11.chm', 0, -2146827284), None)
Traceback (most recent call last):
File "C:\program\program.py", line 90, in <module>
xl.Workbooks.Open(destination_file, ReadOnly=1)
File "<COMObject <unknown>>", line 5, in Open
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Excel', 'Open method of Workbooks class failed', 'xlmain11.chm', 0, -2146827284), None)
INFO | program.py | 112 | 13-01-2023 05:47 +0100 |
与错误相关的代码:
xl = win32com.client.Dispatch("Excel.Application")
# xl.Visible = True
xl.Workbooks.Open(destination_file, ReadOnly=1)
xl.Application.Run("updaterun")
xl.Application.Quit()
del xl
我没有找到任何解决此问题的参考资料
xl.Workbooks.Open(destination_file, ReadOnly=1,CorruptLoad=1)
Desktop 文件夹:
C:\Windows\System32\config\systemprofile\Desktop
C:\Windows\SysWOW64\config\systemprofile\Desktop
不要问我为什么,坦白说,这很可怕,但它立即起作用了。在 this thread 上找到。 在将 xlwings
库与 Windows 任务计划程序结合使用时,我遇到了同样的错误。这不是 Python 问题,这一点很清楚。