Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 139837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:30:24+00:00 2026-05-11T07:30:24+00:00

Here is part of a stack-trace from a recent run of an unreliable application

  • 0

Here is part of a stack-trace from a recent run of an unreliable application written in Python which controls another application written in Excel:

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

Obviously something has gone wrong … but what?[1] These COM error codes seem to be excessively cryptic.

How can I decode this error message? Is there a table somewhere that allows me to convert this numerical error code into something more meaningful?

[1] I actually know what went wrong in this case, it was attempting to access a Name prperty on a Range object which did not have a Name property… not all bugs are this easy to find!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:30:24+00:00Added an answer on May 11, 2026 at 7:30 am

    You are not doing anything wrong. The first item in your stack trace (the number) is the error code returned by the COM object. The second item is the description associated with the error code which in this case is ‘Exception Occurred’. pywintypes.com_error already called the equivalent of win32api.FormatMessage(errCode) for you. We’ll look at the second number in a minute.

    By the way, you can use the ‘Error Lookup’ utility that comes in Visual Studio (C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\ErrLook.exe) as a quick launching pad to check COM error codes. That utility also calls FormatMessage for you and displays the result. Not all error codes will work with this mechanism, but many will. That’s usually my first stop.

    Error handling and reporting in COM is a bit messy. I’ll try to give you some background.

    All COM method calls will return a numeric code called an HRESULT that can indicate success or failure. All forms of error reporting in COM build on top of that.

    The codes are commonly expressed in hex, although sometimes you will see them as large 32-bit numbers, like in your stack trace. There are all kinds of predefined return codes for common results and problems, or the object can return custom numeric codes for special situations. For example, the value 0 (called S_OK) universally means ‘No error’ and 0x80000002 is E_OUTOFMEMORY. Sometimes the HRESULT codes are returned by the object, sometimes by the COM infrastructure.

    A COM object can also choose to provide much richer error information by implementing an interface called IErrorInfo. When an object implements IErrorInfo, it can provide all kinds of detail about what happened, such as a detailed custom error message and even the name of a help file that describes the problem. In VB6 and VBA. the Err object allows you to access all that information (Err.Description, etc).

    To complicate matters, late bound COM objects (which use a mechanism called COM Automation or IDispatch) add some layers that need to be peeled off to get information out. Excel is usually manipulated via late binding.

    Now let’s look at your situation again. What you are getting as the first number is a fairly generic error code: DISP_E_EXCEPTION. Note: you can usually figure out the official name of an HRESULT by googling the number, although sometimes you will have to use the hex version to find anything useful.

    Errors that begin with DISP_ are IDISPATCH error codes. The error loosely means ‘There was a COM exception thrown by the object’, with more information packed elsewhere (although I don’t quite know where; I’ll have to look it up).

    From what I understand of pywintypes.com_error, the last number in your message is the actual error code that was returned by the object during the exception. It’s the actual numeric code that you would get out of VBA’s Err.Number.

    Unfortunately, that second code -2146788248 (0x800A9C68) is in the range reserved for custom application-defined error messages (in VBA: VbObjectError + someCustomErrorNumber), so there is no centralized meaning. The same number can mean entirely different things for different programs.

    In this case, we have reached a dead end:

    The error code is ‘custom’, and the application needs to document what it is, except that Excel doesn’t. Also, Excel (or the actual source of the error) doesn’t seem to be providing any more information via IErrorInfo.

    Excel is notorious (to me at least) for cryptic error codes from automation and obscure situations that cause them. This is especially so for errors that one could consider ‘design-time errors’ (‘you should have known better than calling a method that doesn’t exist in the object’). Instead of a nice ‘Could not read the Name property’, you get ‘Run-time error ‘1004’: Application defined or object-defined error‘ (which I just got by trying to access a Name property on a Range, from VBA in Excel). That is NOT very helpful.

    The problem is not routed on Python or it’s interface to Excel. Excel itself doesn’t explain what happened, even to VBA.

    However, the general procedure above remains valid. If you get an error from Excel in the future, you might get a better error message that you can track the same way.

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the stack trace which appears on resque-web interface: http://gist.github.com/396893 There you can
Here is part of my web.xml: <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:application-config.xml </param-value> </context-param> application-config.xml uses
I'm using implementation of SimpleCursorAdapter , which implements SectionIndexer . Here's part of it:
Here is a part from my program: try { Class.forName(com.mysql.jdbc.Driver); InitializeData data = new
I have an error log from a user with a stack trace that I
I'm copying code from one part of our application (an applet) to inside the
I'm rather confused by this stack trace (only the confusing part is shown): -[NSXMLDocument
Here's part of my Django app's models.py : class Person(models.Model): birth_year = WideYear(null=True, blank=True)
Here is part 1 of our problem (Loading a dynamically generated XML file as
Here's part of my code for a jQuery word counter. My question is: how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.