<?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: Two issues creating a script tool in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21309#M1627</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brad,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need the advanced editor syntax formatting to make code more readable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See: &lt;A href="https://community.esri.com/migration-blogpost/1070"&gt;Posting Code blocks in the new GeoNet&lt;/A&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Jul 2015 15:18:05 GMT</pubDate>
    <dc:creator>IanMurray</dc:creator>
    <dc:date>2015-07-17T15:18:05Z</dc:date>
    <item>
      <title>Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21307#M1625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have this script below.&amp;nbsp; When the three arguments are set as variables and I run the script in the ArcMap Python window to test it it runs perfectly.&amp;nbsp; I created a tool for this script.&amp;nbsp; In the parameters for the tool properties I have the Data Types for the 3 arguments are set as "SQL expressions" and all the data types for the feature layers created are "Feature Layers" with a "Type: Derived" and "Direction: Output".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First problem: when I run the tool with the script as is i get this error '&lt;SPAN style="color: #e23d39;"&gt;RuntimeError: LayerObject: Set attribute showLabels does not exist&lt;/SPAN&gt;'. I remove the code block that applies the labels then I get this error '&lt;SPAN style="color: #e23d39;"&gt;ValueError: Unknown value for Extent argument&lt;/SPAN&gt;'. Running the script in the mxd both code blocks work perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second Problem: I remove both code blocks from the script and run the tool and nothing happens.&amp;nbsp; No errors. Just doesn't add layers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import modules
import os, arcpy


# Set arguments
pws = arcpy.GetParameterAsText(0)
ass_pws = arcpy.GetParameterAsText(1)
mtr_recpws = arcpy.GetParameterAsText(2)


# Set variables&amp;nbsp; 
sources = r"V:\Source Water Protection\SWAP Model\SWAP.code_newrasters\GIS\SWAP.gdb\sources" # Will need to change if used outside of SWPP staff because of directory permissions. "Sources"&amp;nbsp; feature class is in WATER_FACILITY.gdb
assessment = r"V:\Source Water Protection\SWAP Model\SWAP.code_newrasters\GIS\SWAP.gdb\assessment_areas" # Will need to change if used outside of SWPP staff because of directory permissions. "Assessments" feature class not in WATER_FACILITY.gdb..
meter = r"V:\WATER_FACILITY\WATER_FACILITY.gdb\MASTER_METER"
files = ["BACTI", "DBP", "DBP_STAGE2", "OFFICE", "PRV", "PUMP_STATION", "SERVICE_AREA_COMBO", "TANK", "VALVE_MISCELLANEOUS", "WTP"] # list all names used for feature classes ans .lyr files. 
layers = ["Bacti", "DBP", "DBP Stage 2", "Office", "PRV", "Pump Station", "Service Area", "Tank","Valve", "Water Treatment Plant"]
src_layer = "Source"
ass_layer = "Assessment Area"
mtr_layer = "Master Meter"
src_symb = r"V:\Source Water Protection\PWS_ID_Tool\SOURCE.lyr"
ass_symb = r"V:\Source Water Protection\PWS_ID_Tool\ASSESSMENT.lyr"
mtr_symb = r"V:\Source Water Protection\PWS_ID_Tool\MASTER_METER.lyr"
root = r"V:\WATER_FACILITY\WATER_FACILITY.gdb" 
symRoot = r"V:\Source Water Protection\PWS_ID_Tool"


# Create directory paths, make feature layers, and apply symbologies.
for i, file in enumerate(files):
&amp;nbsp;&amp;nbsp;&amp;nbsp; path = os.path.join(root, files&lt;I&gt;) # Create directory path for featureclasses &lt;/I&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; symPath = os.path.join(symRoot, files&lt;I&gt; + ".lyr") # Create directory path for .lyr files&lt;/I&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(paths&lt;I&gt;, layers&lt;I&gt;, pws) # Make all the layers from "files" list&lt;/I&gt;&lt;/I&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ApplySymbologyFromLayer_management(layers&lt;I&gt;, symPaths&lt;I&gt;) # Apply the symbologies from "symNames" list.&lt;/I&gt;&lt;/I&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
arcpy.MakeFeatureLayer_management(assessment, ass_layer, ass_pws)
arcpy.ApplySymbologyFromLayer_management(ass_layer, ass_symb)
arcpy.MakeFeatureLayer_management(meter, mtr_layer, mtr_recpws)
arcpy.ApplySymbologyFromLayer_management(mtr_layer, mtr_symb)
arcpy.MakeFeatureLayer_management(sources, src_layer, pws) # Ordered to have the "Source" layer in the 0 position.
arcpy.ApplySymbologyFromLayer_management(src_layer, src_symb)




# Apply label
mxd = arcpy.mapping.MapDocument("CURRENT") # Reference to current open map document. Could insert path.
layer = arcpy.mapping.ListLayers(mxd, "")[0] # Indexing for first layer in table of contents. "Make feature layers" functions ordered so "Source" is in 0 position.
if layer.supports("LABELCLASSES"):&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for lblclass in layer.labelClasses:&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lblclass.showClassLabels = True&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
lblclass.expression = '"%s" &amp;amp; [SOURCE_ID] &amp;amp; "%s"' % ("&amp;lt;CLR red='255'&amp;gt;&amp;lt;FNT size = '12'&amp;gt;", "&amp;lt;/FNT&amp;gt;&amp;lt;/CLR&amp;gt;") 
layer.showLabels = True&amp;nbsp; 
arcpy.RefreshActiveView()


#Apply extent from "Source" layer
mxd = arcpy.mapping.MapDocument("CURRENT") # Using current map, can also use a path to an mxd here&amp;nbsp; 
df = arcpy.mapping.ListDataFrames(mxd)[0]&amp;nbsp; 
lyr = arcpy.mapping.ListLayers(mxd, "", df)[0]&amp;nbsp; 
ext = lyr.getExtent()&amp;nbsp; 
df.extent = ext &lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Brad Jones&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:52:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21307#M1625</guid>
      <dc:creator>BradJones</dc:creator>
      <dc:date>2021-12-10T20:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21308#M1626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For some reason the script didn't post?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 14:40:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21308#M1626</guid>
      <dc:creator>BradJones</dc:creator>
      <dc:date>2015-07-17T14:40:07Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21309#M1627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brad,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need the advanced editor syntax formatting to make code more readable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See: &lt;A href="https://community.esri.com/migration-blogpost/1070"&gt;Posting Code blocks in the new GeoNet&lt;/A&gt;​&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 15:18:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21309#M1627</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-07-17T15:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21310#M1628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, that helped.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 15:23:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21310#M1628</guid>
      <dc:creator>BradJones</dc:creator>
      <dc:date>2015-07-17T15:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21311#M1629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Now when I run the original script in the Python window in the mxd i'm getting this error: &lt;STRONG&gt;NameError: name 'paths' is not defined.&amp;nbsp; &lt;/STRONG&gt;This code ran fine this morning&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 15:36:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21311#M1629</guid>
      <dc:creator>BradJones</dc:creator>
      <dc:date>2015-07-17T15:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21312#M1630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In Line 29, I think paths got changed to path, so paths is no longer defined&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 15:48:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21312#M1630</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-07-17T15:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21313#M1631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brad I tested both the labels portion and the extent portions of your script in arcmap and as a script model both worked without any issues&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;labels&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mxd = arcpy.mapping.MapDocument("CURRENT") # Reference to current open map document. Could insert path.&amp;nbsp; 
layer = arcpy.mapping.ListLayers(mxd, "")[0] # Indexing for first layer in table of contents. "Make feature layers" functions ordered so "Source" is in 0 position.&amp;nbsp; 
if layer.supports("LABELCLASSES"):&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for lblclass in layer.labelClasses:&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lblclass.showClassLabels = True&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
lblclass.expression = '"%s" &amp;amp; [Type] &amp;amp; "%s"' % ("&amp;lt;CLR red='255'&amp;gt;&amp;lt;FNT size = '12'&amp;gt;", "&amp;lt;/FNT&amp;gt;&amp;lt;/CLR&amp;gt;")&amp;nbsp;&amp;nbsp; 
layer.showLabels = True&amp;nbsp;&amp;nbsp;&amp;nbsp; 
arcpy.RefreshActiveView() &lt;/PRE&gt;&lt;P&gt;Extent&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#Apply extent from "Source" layer&amp;nbsp; 
mxd = arcpy.mapping.MapDocument("CURRENT") # Using current map, can also use a path to an mxd here&amp;nbsp;&amp;nbsp;&amp;nbsp; 
df = arcpy.mapping.ListDataFrames(mxd)[0]&amp;nbsp;&amp;nbsp;&amp;nbsp; 
lyr = arcpy.mapping.ListLayers(mxd, "", df)[0]&amp;nbsp;&amp;nbsp;&amp;nbsp; 
ext = lyr.getExtent()&amp;nbsp;&amp;nbsp;&amp;nbsp; 
df.extent = ext&amp;nbsp;&amp;nbsp; 
arcpy.RefreshActiveView()&amp;nbsp; &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:52:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21313#M1631</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2021-12-10T20:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21314#M1632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;ERROR 000732: Input Features: Dataset V does not exist or is not supported&lt;/STRONG&gt; is the error I get when I change 'path' to 'paths'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a serious WTF moment for me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 16:13:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21314#M1632</guid>
      <dc:creator>BradJones</dc:creator>
      <dc:date>2015-07-17T16:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21315#M1633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmmmm...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 16:15:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21315#M1633</guid>
      <dc:creator>BradJones</dc:creator>
      <dc:date>2015-07-17T16:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21316#M1634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think one of your file paths is getting truncated and just the first letter of the file is being used for a tool input, which isn't a valid dataset.&amp;nbsp; Did you get which line the error occured on?&amp;nbsp; You might want to debug using some print statements to make sure all your tool inputs are the values you think they are.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 16:34:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21316#M1634</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-07-17T16:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21317#M1635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Would I add print statements after each directory path?&amp;nbsp; that's what I did the error comes after they all print.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 16:58:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21317#M1635</guid>
      <dc:creator>BradJones</dc:creator>
      <dc:date>2015-07-17T16:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21318#M1636</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would use print statements for every parameters being used in lines 29-32 to make sure they are all correct, since almost all the rest of your values are hard coded into your script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 17:12:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21318#M1636</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-07-17T17:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21319#M1637</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;It goes to turd on line 31&lt;/P&gt;&lt;P class="jive-thread-reply-btn clearfix" style="margin: 15px 0 -10px; font-size: 0.9em; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&lt;/P&gt;&lt;DIV class="jive-thread-reply-btn-correct" style="font-weight: inherit; font-style: inherit; font-size: 12.6000003814697px; font-family: inherit;"&gt;&lt;A _jive_internal="true" href="https://community.esri.com/message/536917?et=watches.email.thread" style="margin: 0 20px 0 0; padding: 2px 14px 4px 28px; font-weight: bold; font-style: inherit; font-size: 12.6000003814697px; font-family: inherit; color: #287433; background-color: #f3f3f3;"&gt;Re: Two issues creating a script tool&lt;/A&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 17:43:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21319#M1637</guid>
      <dc:creator>BradJones</dc:creator>
      <dc:date>2015-07-17T17:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21320#M1638</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, paths is a string not a list, so paths&lt;I&gt; would give you the first character of the string paths (or the letter V in this case).&amp;nbsp; Take away the index from paths in that tool and it should work.&lt;/I&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 17:56:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21320#M1638</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-07-17T17:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21321#M1639</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the code block that is working for me now. So in line 3 where I create the featurelass paths, I'm not creating a 'list' of paths stored in memory, but a bunch of individual strings that are the paths?&amp;nbsp; I would think &lt;STRONG&gt;path &lt;/STRONG&gt;in line 5 would have to be indexed with&lt;STRONG&gt; layers&lt;I&gt;,&lt;/I&gt;&lt;/STRONG&gt;&lt;I&gt; and the same for &lt;STRONG&gt;symPath&lt;/STRONG&gt;?&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Create directory paths, make feature layers, and apply symbologies. 
for i, file in enumerate(files): 
&amp;nbsp;&amp;nbsp;&amp;nbsp; path = os.path.join(root, files&lt;I&gt;) # Create directory path for featureclasses &lt;/I&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; symPath = os.path.join(symRoot, files&lt;I&gt; + ".lyr") # Create directory path for .lyr files &lt;/I&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(path, layers&lt;I&gt;, pws) # Make all the layers from "files" list &lt;/I&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ApplySymbologyFromLayer_management(layers&lt;I&gt;, symPath) # Apply the symbologies from "symNames" list.&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:52:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21321#M1639</guid>
      <dc:creator>BradJones</dc:creator>
      <dc:date>2021-12-10T20:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21322#M1640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;BTW, thanks for your help.&amp;nbsp; I'm having one of those days.&amp;nbsp; I swear the code block ran as written in the first post.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 18:48:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21322#M1640</guid>
      <dc:creator>BradJones</dc:creator>
      <dc:date>2015-07-17T18:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21323#M1641</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That would not be the case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your path is changing each time your for loop runs, based on which file you are using(a list which is being iterated through with enumerate), whereas layers is a list that is NOT being iterated over. Therefore, to get the proper item out of the layers list, you need an index equal to the iteration ([layers&lt;I&gt;).&amp;nbsp; path and symPath are strings created each time you go through the for loop based on the file(os.path.join returns a string not a list), so using an index on them would return the string characters of the index.&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you are being a little thrown off since in line 3 and 4, the second parameter is files&lt;I&gt;, which while works for this, is not very pythonic.&amp;nbsp; Both could be changed to file, since we are in a for-loop, and using the list we are iterating with an index instead of the item that is returned from the loop with the iterator.&amp;nbsp; &lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TBH, I have never used the enumerate function, though it works well for what you are doing.&amp;nbsp; My python is not the strongest, I mainly use it only for use in arcpy, so perhaps a more "pythonic" person would like to explain this more succinctly (&lt;A href="https://community.esri.com/migrated-users/3100"&gt;Xander Bakker&lt;/A&gt;​, &lt;A href="https://community.esri.com/migrated-users/4811"&gt;Richard Fairhurst&lt;/A&gt;​, &lt;A href="https://community.esri.com/migrated-users/3116"&gt;Dan Patterson&lt;/A&gt;​, &lt;A href="https://community.esri.com/migrated-users/16710"&gt;Wes Miller&lt;/A&gt;​)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 18:59:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21323#M1641</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-07-17T18:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21324#M1642</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What you said makes sense.&amp;nbsp; Basically, for each loop it starts at line 3, make creates the fc path. Line 4 creates the .lyr path.&amp;nbsp; Line 5 makes the feature layer using the path created in line 3, and the indexed fc file, and the indexed 'layers', and so on. But as I just proved to myself, 'files&lt;I&gt;' doesn't have to be indexed.&amp;nbsp; just call them 'file'.&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 19:17:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21324#M1642</guid>
      <dc:creator>BradJones</dc:creator>
      <dc:date>2015-07-17T19:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21325#M1643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Back to the original two problems.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 19:59:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21325#M1643</guid>
      <dc:creator>BradJones</dc:creator>
      <dc:date>2015-07-17T19:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: Two issues creating a script tool</title>
      <link>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21326#M1644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brad I tested both individually and they both worked for me. See the above code for how i used them the only changes i made were labels code line 6 i changed the field name to work with the field in my data in the extent i added line 7.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 20:10:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/two-issues-creating-a-script-tool/m-p/21326#M1644</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2015-07-17T20:10:28Z</dc:date>
    </item>
  </channel>
</rss>

