AnsweredAssumed Answered

talking to arcgisscripting.ExecuteError in custom python tool

Question asked by morangm on Mar 12, 2012
Latest reply on Mar 13, 2012 by mdenil
I've created a custom tool using python geoprocessing, and it contains a bunch of Network Analyst tools.

At one point in my code, I calculate an OD Cost Matrix and then use the results to do other stuff.  However, it is conceivable that the OD Cost Matrix could yield no results, which leads to a "No Solution Found" error.

<class 'arcgisscripting.ExecuteError'>: ERROR 030024: Solve returned a failure.
No solution found.
Failed to execute (Solve).

The tool then crashes and exits.

However, when this case occurs, I'd rather simply alert the user and then have the tool continue the analysis in a different way.  So I want to include a logic statement.  However, I can't figure out how to actually talk to this error message/exception within python.

How do I code something that does this:
if ("No Solution Found" = TRUE):
   Do this...

Thanks!

Outcomes