<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: talking to arcgisscripting.ExecuteError in custom python tool in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/talking-to-arcgisscripting-executeerror-in-custom/m-p/113457#M3879</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Use a general except clause with &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print arcpy.GetMessages(3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;so arcpy reports the actual error returned.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;run the script so it fails on the error you want to identify.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy should report the error you want to make a named exception for.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Mar 2012 11:39:58 GMT</pubDate>
    <dc:creator>markdenil</dc:creator>
    <dc:date>2012-03-13T11:39:58Z</dc:date>
    <item>
      <title>talking to arcgisscripting.ExecuteError in custom python tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/talking-to-arcgisscripting-executeerror-in-custom/m-p/113454#M3876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've created a custom tool using python geoprocessing, and it contains a bunch of Network Analyst tools.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At one point in my code, I calculate an OD Cost Matrix and then use the results to do other stuff.&amp;nbsp; However, it is conceivable that the OD Cost Matrix could yield no results, which leads to a "No Solution Found" error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;class 'arcgisscripting.ExecuteError'&amp;gt;: ERROR 030024: Solve returned a failure.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;No solution found.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (Solve).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The tool then crashes and exits.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, when this case occurs, I'd rather simply alert the user and then have the tool continue the analysis in a different way.&amp;nbsp; So I want to include a logic statement.&amp;nbsp; However, I can't figure out how to actually talk to this error message/exception within python.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do I code something that does this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if ("No Solution Found" = TRUE):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Do this...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2012 19:32:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/talking-to-arcgisscripting-executeerror-in-custom/m-p/113454#M3876</guid>
      <dc:creator>MelindaMorang1</dc:creator>
      <dc:date>2012-03-12T19:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: talking to arcgisscripting.ExecuteError in custom python tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/talking-to-arcgisscripting-executeerror-in-custom/m-p/113455#M3877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;A try / except struture allows you to identify named exceptions (and identify multiple named exceptions) and catch them with an appropriate handler.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; You can either assign a single except routine to multiple named exceptions, or different except routines to different errors.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;try: &amp;nbsp;&amp;nbsp;&amp;nbsp; #do stuff except 'arcgisscripting.ExecuteError': &amp;nbsp;&amp;nbsp;&amp;nbsp; continue except (differentError1, differentError2): &amp;nbsp;&amp;nbsp;&amp;nbsp; pass&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 11:09:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/talking-to-arcgisscripting-executeerror-in-custom/m-p/113455#M3877</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2012-03-13T11:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: talking to arcgisscripting.ExecuteError in custom python tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/talking-to-arcgisscripting-executeerror-in-custom/m-p/113456#M3878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; You can either assign a single except routine to multiple named exceptions, or different except routines to different errors.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, mdenil!&amp;nbsp; That makes sense, and I have no idea why I didn't think of that myself.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What's the syntax for the particular error I'm looking for? I know there are several reasons I could get an "ERROR 030024"&amp;nbsp; I'd want the code to fail for anything other than "No solution found."&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 11:25:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/talking-to-arcgisscripting-executeerror-in-custom/m-p/113456#M3878</guid>
      <dc:creator>MelindaMorang1</dc:creator>
      <dc:date>2012-03-13T11:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: talking to arcgisscripting.ExecuteError in custom python tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/talking-to-arcgisscripting-executeerror-in-custom/m-p/113457#M3879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Use a general except clause with &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print arcpy.GetMessages(3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;so arcpy reports the actual error returned.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;run the script so it fails on the error you want to identify.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy should report the error you want to make a named exception for.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2012 11:39:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/talking-to-arcgisscripting-executeerror-in-custom/m-p/113457#M3879</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2012-03-13T11:39:58Z</dc:date>
    </item>
  </channel>
</rss>

