<?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: Script works in python win but does not in al toolbox within ArcMAP in Transportation Questions</title>
    <link>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17081#M71</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: AdamCox&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok, I don't know the earlier parts of your code, but perhaps there is an issue with how you are creating the layers and/or getting them from the tool parameters... assuming you are running it through a tool dialogue box.&amp;nbsp; It may also have to do with the parameter types you are using in the dialogue box.&amp;nbsp; Can you pass that information along?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Feb 2014 17:41:09 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2014-02-20T17:41:09Z</dc:date>
    <item>
      <title>Script works in python win but does not in al toolbox within ArcMAP</title>
      <link>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17076#M66</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: af.ramirez&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi everybody...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've been developing a quite long script, and I tested it in PyScripter an IDLE when it was finished.... well it works perfectly, so I added it to a toolbox in ArcMAP and when I ran it it did not work....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have spent many days trying to figure out what the problem is but until now it has been imposible...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a piece of the code where the error comes out...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "Startin iterations"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print datetime.datetime.now()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fields= ("FID", "avg_mindis", "I_conc", "Max_lenght","TamanoTerr")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##create UpdateCursor and iterate trough each register&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(territory,&amp;nbsp; fields) as cursor:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentID= row[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print currentID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ## select current cell with current FID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG&gt; where= " FID = " + str(currentID)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(territory_lyr, "NEW_SELECTION", where )&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByLocation_management(eventos_lyr, "INTERSECT", territory_lyr, "" , "NEW_SELECTION") &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know if maybe there is a problem with the selection by attributes...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Appreciate any help..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Felipe Ramirez&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;GIS Analyst&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]31617[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2014 13:35:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17076#M66</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-02-20T13:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: Script works in python win but does not in al toolbox within ArcMAP</title>
      <link>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17077#M67</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: AdamCox&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Felipe, can you describe the error that you get?&amp;nbsp; Are you using any error handling?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2014 14:24:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17077#M67</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-02-20T14:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: Script works in python win but does not in al toolbox within ArcMAP</title>
      <link>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17078#M68</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a try - Except sentence starting before this line with arcpy.da.UpdateCursor(territory, fields) as cursor:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and the error I get is this&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2014 14:44:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17078#M68</guid>
      <dc:creator>Andres_FelipeRamirez_Mejia</dc:creator>
      <dc:date>2014-02-20T14:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Script works in python win but does not in al toolbox within ArcMAP</title>
      <link>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17079#M69</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: AdamCox&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;hmm, if you import the sys and traceback modules, you can add this code in the except statement:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
pymsg = "PYTHON ERRORS:\nTraceback Info:\n" + tbinfo + "\nError Info:\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "\
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + str(sys.exc_type) + ": " + str(sys.exc_value) + "\n"
msgs = "ARCPY ERRORS:\n" + arcpy.GetMessages(2) + "\n"
print pymsg
print msgs
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Hopefully you can get more detailed information about what's going on.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:41:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17079#M69</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-10T20:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Script works in python win but does not in al toolbox within ArcMAP</title>
      <link>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17080#M70</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Adam...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I added the code you gave me and the new nessages didn't show new info about what's going on...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;look at the messages...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]31634[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2014 17:32:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17080#M70</guid>
      <dc:creator>Andres_FelipeRamirez_Mejia</dc:creator>
      <dc:date>2014-02-20T17:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: Script works in python win but does not in al toolbox within ArcMAP</title>
      <link>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17081#M71</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: AdamCox&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok, I don't know the earlier parts of your code, but perhaps there is an issue with how you are creating the layers and/or getting them from the tool parameters... assuming you are running it through a tool dialogue box.&amp;nbsp; It may also have to do with the parameter types you are using in the dialogue box.&amp;nbsp; Can you pass that information along?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2014 17:41:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17081#M71</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-02-20T17:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Script works in python win but does not in al toolbox within ArcMAP</title>
      <link>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17082#M72</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Adam...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is an example of the code...with some modifications&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import datetime&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import os&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import sys&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import traceback&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.overwriteOutput = True&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;territory= arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;path= arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.MakeFeatureLayer_management(territory,"territory_lyr")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fldFID = arcpy.Describe(territory).OIDFieldName&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print "ID: "+fldFID&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fields= (fldFID, "avg_mindis", "I_conc", "Max_lenght","TamanoTerr")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(territory,&amp;nbsp; fields) as cursor:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentID = row[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where = "{0}={1}".format(arcpy.AddFieldDelimiters(territory, fldFID), currentID)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "where: "+where&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management("territory_lyr", "NEW_SELECTION", where)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Selection ok"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;except Exception as e:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tb = sys.exc_info()[2]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tbinfo = traceback.format_tb(tb)[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pymsg = "PYTHON ERRORS:\nTraceback Info:\n" + tbinfo + "\nError Info:\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "\&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + str(sys.exc_type) + ": " + str(sys.exc_value) + "\n"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; msgs = "ARCPY ERRORS:\n" + arcpy.GetMessages(2) + "\n"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print pymsg&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print msgs&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and the error is....[ATTACH=CONFIG]31637[/ATTACH]&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2014 17:47:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17082#M72</guid>
      <dc:creator>Andres_FelipeRamirez_Mejia</dc:creator>
      <dc:date>2014-02-20T17:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Script works in python win but does not in al toolbox within ArcMAP</title>
      <link>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17083#M73</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: af.ramirez&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Adam...&lt;BR /&gt;&lt;BR /&gt;Here is an example of the code...with some modifications&lt;BR /&gt;&lt;BR /&gt;import arcpy&lt;BR /&gt;import datetime&lt;BR /&gt;import os&lt;BR /&gt;import sys&lt;BR /&gt;import traceback&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;BR /&gt;&lt;BR /&gt;territory= arcpy.GetParameterAsText(0)&lt;BR /&gt;path= arcpy.GetParameterAsText(1)&lt;BR /&gt;&lt;BR /&gt;arcpy.MakeFeatureLayer_management(territory,"territory_lyr")&lt;BR /&gt;fldFID = arcpy.Describe(territory).OIDFieldName&lt;BR /&gt;print "ID: "+fldFID&lt;BR /&gt;fields= (fldFID, "avg_mindis", "I_conc", "Max_lenght","TamanoTerr")&lt;BR /&gt;&lt;BR /&gt;try:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(territory,&amp;nbsp; fields) as cursor:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentID = row[0]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where = "{0}={1}".format(arcpy.AddFieldDelimiters(territory, fldFID), currentID)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "where: "+where&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management("territory_lyr", "NEW_SELECTION", where)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Selection ok"&lt;BR /&gt;except Exception as e:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tb = sys.exc_info()[2]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tbinfo = traceback.format_tb(tb)[0]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pymsg = "PYTHON ERRORS:\nTraceback Info:\n" + tbinfo + "\nError Info:\n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "\&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + str(sys.exc_type) + ": " + str(sys.exc_value) + "\n"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; msgs = "ARCPY ERRORS:\n" + arcpy.GetMessages(2) + "\n"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print pymsg&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print msgs&lt;BR /&gt;&lt;BR /&gt;and the error is....[ATTACH=CONFIG]31637[/ATTACH]&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and the parameters are...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2014 18:00:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17083#M73</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-02-20T18:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Script works in python win but does not in al toolbox within ArcMAP</title>
      <link>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17084#M74</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: AdamCox&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I may have found the error: in the code you posted, you need to have "territory_lyr" as the first parameter in AddFieldDelimiters, right now you have the territory string, so that is probably causing an issue with the query.&amp;nbsp; It would be good to use "territory_lyr" in the Describe method as well.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2014 18:20:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17084#M74</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2014-02-20T18:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: Script works in python win but does not in al toolbox within ArcMAP</title>
      <link>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17085#M75</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Adam...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried the things you suggested but the didn't work...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The same error message comes out...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't know what else I can do....&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Feb 2014 19:58:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17085#M75</guid>
      <dc:creator>Andres_FelipeRamirez_Mejia</dc:creator>
      <dc:date>2014-02-20T19:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script works in python win but does not in al toolbox within ArcMAP</title>
      <link>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17086#M76</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: AdamCox&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, you could rework the code so you don't have to use SelectByAttribute.&amp;nbsp; This could work provided that the where clause is not the problem:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
territory= arcpy.GetParameterAsText(0)
path= arcpy.GetParameterAsText(1)

arcpy.MakeFeatureLayer_management(territory,"territory_lyr")
fldFID = arcpy.Describe(territory).OIDFieldName
print "ID: "+fldFID
fields= (fldFID, "avg_mindis", "I_conc", "Max_lenght","TamanoTerr")

try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor("territory_lyr", fields) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; currentID = row[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where = "{0}={1}".format(arcpy.AddFieldDelimiters("territory_lyr", fldFID), currentID)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "where: "+where

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #instead of making selection, just create a new feature layer using the where clause
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management("territory_lyr","territory_lyrSELECT",where)

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.SelectLayerByAttribute_management("territory_lyr", "NEW_SELECTION", where)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Selection ok"
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;You could try casting the currentID as a string, though it seems redundant at this point.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:41:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/script-works-in-python-win-but-does-not-in-al/m-p/17086#M76</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-10T20:41:08Z</dc:date>
    </item>
  </channel>
</rss>

