4

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.

arcpy.MakeMosaicLayer_management(
 in_mosaic_dataset="//server/share//data.gdb/MOSAIC1",
 out_mosaic_layer="MOSAIC1_lyr"
)
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Feb 10, 2016 at 17:00
3
  • 1
    I would run Check Geometry on each feature class. You can query the output tables, looking for Null Geometry, Unclosed rings, etc. 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? 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

0

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.

answered Mar 10, 2016 at 8:39
1

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.