gpt4 book ai didi

xlwings - pywintypes.com_error : (-2147352567, 'Exception occurred.',(0,无,无,无,0,-2147352565),无)

转载 作者:行者123 更新时间:2023-12-02 13:46:50 32 4
gpt4 key购买 nike

我是从创建的示例 http://docs.xlwings.org/en/stable/vba.html/Python 3.5.1 |Anaconda 2.5.0(32 位)| (默认,2016年1月29日,15:46:01)/并出现错误

--
---------------------------
Error
---------------------------
Traceback (most recent call last):

File "<string>", line 1, in <module>

File "C:\Python3\mymodule.py", line 7, in rand_numbers

n = int(Range('Sheet1', 'B1').value) # Write desired dimensions into Cell B1

File "C:\Python3\lib\site-packages\xlwings\main.py", line 701, in __init__

self.xl_sheet = xlplatform.get_worksheet(self.xl_workbook, sheet_name_or_index)

File "C:\Python3\lib\site-packages\xlwings\_xlwindows.py", line 240, in get_worksheet

return xl_workbook.Sheets(sheet)

File "C:\Python3\lib\site-packages\win32com\client\dynamic.py", line 192, in __call__

return self._get_good_object_(self._oleobj_.Invoke(*allArgs),self._olerepr_.defaultDispatchName,None)

pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147352565), None)



Press Ctrl+C to copy this message to the clipboard.
---------------------------
OK
---------------------------

最佳答案

嘿,所以错误意味着:

>>> import win32api
>>> win32api.FormatMessage(-2147352565)
'Invalid index.\r\n'

所以我的猜测是,您正在尝试写入不存在的工作表(是的,我们将致力于更容易理解的错误消息......)

关于xlwings - pywintypes.com_error : (-2147352567, 'Exception occurred.',(0,无,无,无,0,-2147352565),无),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36064723/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com