<?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: Handle specify error in arcpy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/handle-specific-error-in-arcpy/m-p/1131909#M63456</link>
    <description>&lt;P&gt;ex.args only contains a single element which is the full error description. Path names removed and replaced with "&amp;lt;value&amp;gt;".&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;ERROR 000466: &lt;SPAN&gt;&amp;lt;value&amp;gt;&lt;/SPAN&gt; does not match the schema of target &lt;SPAN&gt;&amp;lt;value&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;Failed to execute (Append).&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;As noted previously, I can parse this string to get the error number, but I can remember older versions of Python having an errno value.&amp;nbsp; Ultimately, I want to delete the feature class when this error occurs and create a new version with the modified schema.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jan 2022 00:37:00 GMT</pubDate>
    <dc:creator>LanceCole</dc:creator>
    <dc:date>2022-01-10T00:37:00Z</dc:date>
    <item>
      <title>Handle specific error in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/handle-specific-error-in-arcpy/m-p/1131901#M63454</link>
      <description>&lt;P&gt;I am&amp;nbsp; have a question pertaining to handling specific errors in arcpy 3.7.&amp;nbsp; I want to capture the specific ERROR 000466: &amp;lt;value&amp;gt; does not match the schema of target &amp;lt;value&amp;gt;.&amp;nbsp; The following code narrows it down to the arcpy.ExecuteError, but I cannot find a graceful method to further identify the error as ERROR 000466.&amp;nbsp; The&amp;nbsp; sys.exc_info()[1] returns the entire error value but I would just like the error number without having to parse the string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;try:
   my code here...
except arcpy.ExecuteError:
   e = sys.exc_info()[1]
   print(e)
except:
   handle of other errors&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 02:41:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/handle-specific-error-in-arcpy/m-p/1131901#M63454</guid>
      <dc:creator>LanceCole</dc:creator>
      <dc:date>2022-01-10T02:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Handle specify error in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/handle-specific-error-in-arcpy/m-p/1131907#M63455</link>
      <description>&lt;P&gt;I can't easily recreate the ExecutionError exception but one thing I would try is to see what you get with the exception's 'args' property, which will give you the arguments passed in by the ESRI code when the exception was created.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;try:
   my code here...
except arcpy.ExecuteError as ex:
   print (str(ex.args))  # Maybe the specific error code is one of the args ??????
   e = sys.exc_info()[1]
   print(e)
except:
   handle of other errors&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jan 2022 22:52:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/handle-specific-error-in-arcpy/m-p/1131907#M63455</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2022-01-09T22:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Handle specify error in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/handle-specific-error-in-arcpy/m-p/1131909#M63456</link>
      <description>&lt;P&gt;ex.args only contains a single element which is the full error description. Path names removed and replaced with "&amp;lt;value&amp;gt;".&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;ERROR 000466: &lt;SPAN&gt;&amp;lt;value&amp;gt;&lt;/SPAN&gt; does not match the schema of target &lt;SPAN&gt;&amp;lt;value&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;Failed to execute (Append).&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;As noted previously, I can parse this string to get the error number, but I can remember older versions of Python having an errno value.&amp;nbsp; Ultimately, I want to delete the feature class when this error occurs and create a new version with the modified schema.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 00:37:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/handle-specific-error-in-arcpy/m-p/1131909#M63456</guid>
      <dc:creator>LanceCole</dc:creator>
      <dc:date>2022-01-10T00:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Handle specific error in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/handle-specific-error-in-arcpy/m-p/1131959#M63457</link>
      <description>&lt;P&gt;Seems like arcpy.ExecuteError has only two public attributes: args and with_traceback(). You probably won't get around parsing the string.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;try:
    arcpy.management.Append(fc_wrong_schema, target_fc)
except arcpy.ExecuteError as e:
    if "ERROR 000466" in e.args[0]:
        # handle
        print("DELETE FEATURE CLASS")
    else:
        # handle or raise
        raise
except:
    # handle or raise
    pass&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 09:46:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/handle-specific-error-in-arcpy/m-p/1131959#M63457</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-01-10T09:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: Handle specific error in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/handle-specific-error-in-arcpy/m-p/1131990#M63458</link>
      <description>&lt;P&gt;Thanks for the reply.&amp;nbsp; I just wanted to make sure I was not missing something obvious.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 13:05:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/handle-specific-error-in-arcpy/m-p/1131990#M63458</guid>
      <dc:creator>LanceCole</dc:creator>
      <dc:date>2022-01-10T13:05:50Z</dc:date>
    </item>
  </channel>
</rss>

