<?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>idea Make arcpy.AddWarning wrapped in script warnings! in Python Ideas</title>
    <link>https://community.esri.com/t5/python-ideas/make-arcpy-addwarning-wrapped-in-script-warnings/idi-p/1189701</link>
    <description>&lt;P&gt;arcpy.Add Warning could just throw a normal warning. Doe make sense to you people need to do a wrapper every time in a pyt, toolbox and the like just to test?&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;scriptwarning&lt;/SPAN&gt;(func):&lt;BR /&gt;    &lt;SPAN&gt;"""&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    Arcpy Warning Wraper&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    :param func:&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    :return:&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    """&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;wrap&lt;/SPAN&gt;(*args&lt;SPAN&gt;, &lt;/SPAN&gt;**kwargs):&lt;BR /&gt;&lt;BR /&gt;        result = func(*args&lt;SPAN&gt;, &lt;/SPAN&gt;**kwargs)&lt;BR /&gt;        warnings.warn(*args)&lt;BR /&gt;        &lt;SPAN&gt;return &lt;/SPAN&gt;result&lt;BR /&gt;    &lt;SPAN&gt;return &lt;/SPAN&gt;wrap&lt;BR /&gt;&lt;BR /&gt;arcpy.AddWarning = scriptwarning(arcpy.AddWarning)&lt;/PRE&gt;&lt;P&gt;I don`t like doing it, it seams crazily wrong, for something simple.&lt;BR /&gt;If arcpy throws a warning why should I wrap it to test and get an expected warning?&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jul 2022 04:29:53 GMT</pubDate>
    <dc:creator>HildermesJoséMedeirosFilho</dc:creator>
    <dc:date>2022-07-06T04:29:53Z</dc:date>
    <item>
      <title>Make arcpy.AddWarning wrapped in script warnings!</title>
      <link>https://community.esri.com/t5/python-ideas/make-arcpy-addwarning-wrapped-in-script-warnings/idi-p/1189701</link>
      <description>&lt;P&gt;arcpy.Add Warning could just throw a normal warning. Doe make sense to you people need to do a wrapper every time in a pyt, toolbox and the like just to test?&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;scriptwarning&lt;/SPAN&gt;(func):&lt;BR /&gt;    &lt;SPAN&gt;"""&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    Arcpy Warning Wraper&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    :param func:&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    :return:&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;    """&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;def &lt;/SPAN&gt;&lt;SPAN&gt;wrap&lt;/SPAN&gt;(*args&lt;SPAN&gt;, &lt;/SPAN&gt;**kwargs):&lt;BR /&gt;&lt;BR /&gt;        result = func(*args&lt;SPAN&gt;, &lt;/SPAN&gt;**kwargs)&lt;BR /&gt;        warnings.warn(*args)&lt;BR /&gt;        &lt;SPAN&gt;return &lt;/SPAN&gt;result&lt;BR /&gt;    &lt;SPAN&gt;return &lt;/SPAN&gt;wrap&lt;BR /&gt;&lt;BR /&gt;arcpy.AddWarning = scriptwarning(arcpy.AddWarning)&lt;/PRE&gt;&lt;P&gt;I don`t like doing it, it seams crazily wrong, for something simple.&lt;BR /&gt;If arcpy throws a warning why should I wrap it to test and get an expected warning?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 04:29:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/make-arcpy-addwarning-wrapped-in-script-warnings/idi-p/1189701</guid>
      <dc:creator>HildermesJoséMedeirosFilho</dc:creator>
      <dc:date>2022-07-06T04:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: Make arcpy.AddWarning wrapped in script warnings!</title>
      <link>https://community.esri.com/t5/python-ideas/make-arcpy-addwarning-wrapped-in-script-warnings/idc-p/1189735#M125</link>
      <description>&lt;P data-unlink="true"&gt;Good idea. But Esri would also have to implement this idea:&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/interpret-warnings-as-warnings-instead-of-errors/idi-p/1177992" target="_self"&gt;&lt;SPAN&gt;Interpret warnings as warnings instead of errors in Python tools&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 08:58:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/make-arcpy-addwarning-wrapped-in-script-warnings/idc-p/1189735#M125</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2022-07-06T08:58:20Z</dc:date>
    </item>
  </channel>
</rss>

