我正在尝试在代码中获得一个命名范围,如下所示:
Range(rng_name, index=False).value = df_grouped_a.ix[loc][col]这会产生异常:
File "C:/Users/acme/python/s.py", line 149, in <module>
Range(rng_name, index=False).value = df_grouped_a.ix[loc][col]
File "C:\Program Files (x86)\Python271\lib\site-packages\xlwings\main.py", line 620, in __init__
self.row1 = xlplatform.get_first_row(self.xl_sheet, range_address)
File "C:\Program Files (x86)\Python271\lib\site-packages\xlwings\_xlwindows.py", line 122, in get_first_row
return xl_sheet.Range(range_address).Row
File "<COMObject <unknown>>", line 3, in Range
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2146827284), None)这可能与命名范围问题有关,但我想先了解错误代码-2146827284的含义。
不幸的是,这里描述的方式对我不起作用:https://stackoverflow.com/a/36080159
即:
>>> import win32api
>>> win32api.FormatMessage(-2146827284)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
pywintypes.error: (15100, 'FormatMessage', 'The resource loader failed to find MUI file.')如何找到与此错误代码对应的错误消息?
发布于 2018-02-02 19:19:37
-2146827284可以表示为0x80020009,是一个COM Error Code。如果发生COM异常,则返回平均DISP_E_EXCEPTION -基本值。
将无符号整数‘转换’成无符号整数的最简单方法是应用按位& 0xFFFFFFFF操作。
>>> error = -2146827284
>>> error & 0xffffffff
2147614729但是当你尝试去尝试的时候,你不会看到什么特别的东西
>>> win32api.FormatMessage(error)
Exception occurred.https://stackoverflow.com/questions/48384928
复制相似问题