Is there any way to capture ArcMap Drawing Errors inside of a Python script?

Through Python, I would like to iterate through each layer inside of an MXD, make the layer visible, refresh the table of contents and the active view. I then want to see if any of these layers cause a drawing error, in which case I can write the layer that caused the drawing error to a log file so that I can later review and fix the problem causing the drawing errors. The only problem is I have no idea of how to capture the message from the ArcMap Drawing Error Dialog with Python. I do not particularly care what the error message is, I just want to see if an error is generated.

Example of an ArcMap Drawing Errors Dialog:

Arc Map Drawing Error Example

Another example where the GP finishes without error/exception but an ArcMap Drawing Error pop-up occurs.

  • 1
    I would run Check Geometry on each feature class. You can query the output tables, looking for Null Geometry, Unclosed rings, etc.
    – klewis
    Commented Feb 10, 2016 at 17:18
  • Have you tried wrapping the script in a try except statement and seeing what error messages you capture when you refresh the active map?
    – RHB
    Commented Feb 11, 2016 at 2:09
  • The script runs fine, there are no exceptions to catch (I tried that). It is also not a geometry problem, it is labeling problem. I spoke with ESRI, and they said there is no way to capture the ArcMap Drawing Errors with Python, which I think is unfortunate. Generally speaking, the errors that I am encountering all relate to a label expression referencing a field that no longer exists or was renamed. I should be able to parse the label expression instead and compare that info with the fields to see if there is a mismatch that way. Commented Feb 11, 2016 at 13:31

1 Answer 1


Instead of trying to use ArcPy to do this I think you should see whether MXDPERFSTAT gives you the results that you want:

An ArcGIS Engine command line tool to diagnose typical mxd performance problems. Supports ArcGIS 9.3, 10, 10.1, 10.2, 10.3, 10.4 versions.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.