1

I am trying to get a named Range in code like this:

Range(rng_name, index=False).value = df_grouped_a.ix[loc][col]

This generates exception:

  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)

It might be related to the named range issue, but I would like to get the meaning of error code -2146827284 first.

Unfortunately, the way described here does not work for me: https://stackoverflow.com/a/36080159

Namely:

>>> 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.')

How can I find the error message corresponding to this error code?

LetMeSOThat4U
  • 6,470
  • 10
  • 53
  • 93

1 Answers1

1

-2146827284 may be represented as 0x80020009‬, is a COM Error Code. That mean DISP_E_EXCEPTION - Basic value returned if COM exception ooccured.

Simpliest way to 'convert' singed int to unsigned is to apply bitwise & 0xFFFFFFFF operation.

>>> error = -2146827284
>>> error & 0xffffffff
‭2147614729‬

But nothing special you will see when try to

>>> win32api.FormatMessage(error)
Exception occurred.
Prime Ape
  • 130
  • 3
  • 12