<?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: Model converted to Script -  Why Can't it find the field? in Transportation Questions</title>
    <link>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700903#M2325</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: Wayne_Whitley&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good work, Tim...I referred her look here again at her other thread.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Sep 2013 21:17:13 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2013-09-30T21:17:13Z</dc:date>
    <item>
      <title>Model converted to Script -  Why Can't it find the field?</title>
      <link>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700896#M2318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: ionara_wilson&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a model that an ESRI associate sent me as an example. When I run the model everything is great. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But I need to have it as a script so I converted it to a script and set the Selecting Features parameter to be a "Feature Set"&amp;nbsp; and have a schema of a polygon layer. However when I convert this model to a script and try to run as a script, I get an error saying it cannot find the EditField. However the EditField should have been copied to the layer in the Make Feature Layer process. It is not clear why it cannot find the EditField ! Any help?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The first picture shows the model,&amp;nbsp; the second shows the model when I run it, the third shows the error I get, and the fourth shows the parameters I set before I run the tool. Thank you!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]27890[/ATTACH][ATTACH=CONFIG]27891[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]27892[/ATTACH][ATTACH=CONFIG]27893[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# -*- coding: utf-8 -*- # --------------------------------------------------------------------------- # calcfeatures_script.py # Created on: 2013-09-30 15:22:46.00000 #&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder) # Usage: calcfeatures_script &amp;lt;Selecting_Features&amp;gt; &amp;lt;value&amp;gt;&amp;nbsp; # Description:&amp;nbsp; # test # ---------------------------------------------------------------------------&amp;nbsp; # Import arcpy module import arcpy&amp;nbsp; # Script arguments Selecting_Features = arcpy.GetParameterAsText(0) if Selecting_Features == '#' or not Selecting_Features: &amp;nbsp;&amp;nbsp;&amp;nbsp; Selecting_Features = "in_memory\\{1CFDCCDD-5D8D-42F8-AEB2-E66ED4A51A44}" # provide a default value if unspecified&amp;nbsp; value = arcpy.GetParameterAsText(1)&amp;nbsp; # Local variables: Input_Points = "D:\\ArcGISData\\ESRI_GEO_EX\\GDB.gdb\\SamplePoints" Final_Output = value Selected_Features = Selecting_Features Input_Points_Layer = "SamplePoints_Layer"&amp;nbsp; # Process: Make Feature Layer arcpy.MakeFeatureLayer_management(Input_Points, Input_Points_Layer, "", "", "OBJECTID OBJECTID VISIBLE NONE;SymbologyField SymbologyField VISIBLE NONE;DomainField DomainField VISIBLE NONE;Shape Shape VISIBLE NONE;Subtype Subtype VISIBLE NONE;EditField EditField VISIBLE NONE")&amp;nbsp; # Process: Select Layer By Location arcpy.SelectLayerByLocation_management(Input_Points_Layer, "INTERSECT", Selecting_Features, "", "NEW_SELECTION")&amp;nbsp; # Process: Calculate Field arcpy.CalculateField_management(Selected_Features, "EditField", "'%value%'", "PYTHON_9.3", "") &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Sep 2013 19:50:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700896#M2318</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-09-30T19:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Model converted to Script -  Why Can't it find the field?</title>
      <link>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700897#M2319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: ionara_wilson&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I figured that you can't really convert a model to a script and think everything is going to work. When I converted the model to script, the calculate field process was referencing Selected_features but selected features was a variable that was equal to Selecting Features which meant nothing. I added the Selected Features variable after the select layer by location and made it equal to the Input_points_layer, which was a real layer created before and already selected. Now I just need to figure out how to get the value for the second parameter, which is just showing %value% and not the value I entered for that parameter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# Import arcpy module
import arcpy

# Script arguments
Selecting_Features = arcpy.GetParameterAsText(0)
if Selecting_Features == '#' or not Selecting_Features:
&amp;nbsp;&amp;nbsp;&amp;nbsp; Selecting_Features = "in_memory\\{1CFDCCDD-5D8D-42F8-AEB2-E66ED4A51A44}" # provide a default value if unspecified

value = arcpy.GetParameterAsText(1)

# Local variables:
Input_Points = "D:\\ArcGISData\\ESRI_GEO_EX\\GDB.gdb\\SamplePoints"
Final_Output = value

Input_Points_Layer = "SamplePoints_Layer"

# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(Input_Points, Input_Points_Layer, "", "", "OBJECTID OBJECTID VISIBLE NONE;SymbologyField SymbologyField VISIBLE NONE;DomainField DomainField VISIBLE NONE;Shape Shape VISIBLE NONE;Subtype Subtype VISIBLE NONE;EditField EditField VISIBLE NONE")

# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(Input_Points_Layer, "INTERSECT", Selecting_Features, "", "NEW_SELECTION")
Selected_Features = Input_Points_Layer
# Process: Calculate Field
arcpy.CalculateField_management(Selected_Features, "EditField", "'%value%'", "PYTHON_9.3", "")

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:29:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700897#M2319</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T05:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Model converted to Script -  Why Can't it find the field?</title>
      <link>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700898#M2320</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;hi there,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;you should just be able to use value as the variable in the calculatefield tool without any % or '&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;you might need to use str() or int() depending on the field type&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;hope this helps&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Sep 2013 20:18:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700898#M2320</guid>
      <dc:creator>TimDonoyou</dc:creator>
      <dc:date>2013-09-30T20:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: Model converted to Script -  Why Can't it find the field?</title>
      <link>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700899#M2321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: ionara_wilson&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried that but I got this error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Executing: CalcFeatures "Feature Set" sdfgsdfgsdfg&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Start Time: Mon Sep 30 16:20:07 2013&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Running script CalcFeatures...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "D:\ArcGISData\ESRI_GEO_EX\calcfeatures_script.py", line 35, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CalculateField_management(Selected_Features, "EditField", value2, "PYTHON_9.3", "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\management.py", line 3129, in CalculateField&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: ERROR 000539: Error running expression: sdfgsdfgsdfg &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "&amp;lt;expression&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;NameError: name 'sdfgsdfgsdfg' is not defined&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (CalculateField).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (CalcFeatures).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed at Mon Sep 30 16:20:08 2013 (Elapsed Time: 1.00 seconds)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# calcfeatures_script.py
# Created on: 2013-09-30 15:22:46.00000
#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)
# Usage: calcfeatures_script &amp;lt;Selecting_Features&amp;gt; &amp;lt;value&amp;gt; 
# Description: 
# test
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy

# Script arguments
Selecting_Features = arcpy.GetParameterAsText(0)
if Selecting_Features == '#' or not Selecting_Features:
&amp;nbsp;&amp;nbsp;&amp;nbsp; Selecting_Features = "in_memory\\{1CFDCCDD-5D8D-42F8-AEB2-E66ED4A51A44}" # provide a default value if unspecified

value = arcpy.GetParameterAsText(1)
value2 = str(value)

# Local variables:
Input_Points = "D:\\ArcGISData\\ESRI_GEO_EX\\GDB.gdb\\SamplePoints"
#Final_Output = value

Input_Points_Layer = "SamplePoints_Layer"

# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(Input_Points, Input_Points_Layer, "", "", "OBJECTID OBJECTID VISIBLE NONE;SymbologyField SymbologyField VISIBLE NONE;DomainField DomainField VISIBLE NONE;Shape Shape VISIBLE NONE;Subtype Subtype VISIBLE NONE;EditField EditField VISIBLE NONE")

# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(Input_Points_Layer, "INTERSECT", Selecting_Features, "", "NEW_SELECTION")
Selected_Features = Input_Points_Layer
# Process: Calculate Field
arcpy.CalculateField_management(Selected_Features, "EditField", value2, "PYTHON_9.3", "")
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:29:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700899#M2321</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T05:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Model converted to Script -  Why Can't it find the field?</title>
      <link>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700900#M2322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think it should just be&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CalculateField_management(Selected_Features, "EditField", value, "VB", "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I figured that you can't really convert a model to a script and think everything is going to work. When I converted the model to script, the calculate field process was referencing Selected_features but selected features was a variable that was equal to Selecting Features which meant nothing. I added the Selected Features variable after the select layer by location and made it equal to the Input_points_layer, which was a real layer created before and already selected. Now I just need to figure out how to get the value for the second parameter, which is just showing %value% and not the value I entered for that parameter.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# Import arcpy module
import arcpy

# Script arguments
Selecting_Features = arcpy.GetParameterAsText(0)
if Selecting_Features == '#' or not Selecting_Features:
&amp;nbsp;&amp;nbsp;&amp;nbsp; Selecting_Features = "in_memory\\{1CFDCCDD-5D8D-42F8-AEB2-E66ED4A51A44}" # provide a default value if unspecified

value = arcpy.GetParameterAsText(1)

# Local variables:
Input_Points = "D:\\ArcGISData\\ESRI_GEO_EX\\GDB.gdb\\SamplePoints"
Final_Output = value

Input_Points_Layer = "SamplePoints_Layer"

# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(Input_Points, Input_Points_Layer, "", "", "OBJECTID OBJECTID VISIBLE NONE;SymbologyField SymbologyField VISIBLE NONE;DomainField DomainField VISIBLE NONE;Shape Shape VISIBLE NONE;Subtype Subtype VISIBLE NONE;EditField EditField VISIBLE NONE")

# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(Input_Points_Layer, "INTERSECT", Selecting_Features, "", "NEW_SELECTION")
Selected_Features = Input_Points_Layer
# Process: Calculate Field
arcpy.CalculateField_management(Selected_Features, "EditField", "'%value%'", "PYTHON_9.3", "")

&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:29:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700900#M2322</guid>
      <dc:creator>ChrisPedrezuela</dc:creator>
      <dc:date>2021-12-12T05:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: Model converted to Script -  Why Can't it find the field?</title>
      <link>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700901#M2323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: ionara_wilson&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No, that did not work&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Sep 2013 20:23:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700901#M2323</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-09-30T20:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Model converted to Script -  Why Can't it find the field?</title>
      <link>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700902#M2324</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;just out of interest - why do you makefeaturelayer? and redefine selected_features?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i think you should be able to simplify your script to just:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Script arguments&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Selecting_Features = arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;value = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Local variables:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Input_Points = "D:\\ArcGISData\\ESRI_GEO_EX\\GDB.gdb\\SamplePoints"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Select Layer By Location&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.SelectLayerByLocation_management(Input_Points, "INTERSECT", Selecting_Features, "", "NEW_SELECTION")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Calculate Field&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CalculateField_management(Input_Points, "EditField", str(value), "PYTHON_9.3")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tim&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Sep 2013 21:08:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700902#M2324</guid>
      <dc:creator>TimDonoyou</dc:creator>
      <dc:date>2013-09-30T21:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: Model converted to Script -  Why Can't it find the field?</title>
      <link>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700903#M2325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: Wayne_Whitley&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good work, Tim...I referred her look here again at her other thread.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Sep 2013 21:17:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700903#M2325</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-09-30T21:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Model converted to Script -  Why Can't it find the field?</title>
      <link>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700904#M2326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you Tim. When I run that script you provided I get an error though. Don't I have to have a layer instead of a feature class to do a selection?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "D:\ArcGISData\ESRI_GEO_EX\calcfeatures_script.py", line 22, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByLocation_management(Input_Points, "INTERSECT", Selecting_Features, "", "NEW_SELECTION")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\management.py", line 6559, in SelectLayerByLocation&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000368: Invalid input data.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (SelectLayerByLocation).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Oct 2013 14:33:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700904#M2326</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2013-10-01T14:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Model converted to Script -  Why Can't it find the field?</title>
      <link>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700905#M2327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: Wayne_Whitley&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ah, good catch, directly from the 10.1 help the 1st parameter which is the layer you are selecting from must be a feature layer:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"The input can be a layer in the ArcMap table of contents, or a layer created in ArcCatalog or in scripts using the Make Feature Layer tool. The input cannot be the path to a feature class on disk."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the 'select layer' or the layer/fc you are using to select with can be an fc...both can be a layer if I'm not mistaken - what's interesting is you can fetch layer references from your map, i.e. feed in layer objects.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, try this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

# Script arguments
Input_Points = arcpy.GetParameterAsText(0)
value = arcpy.GetParameterAsText(1)

# Local variables:
Selecting_Features = r' enter path to your selecting features '

# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(Input_Points, "INTERSECT", Selecting_Features, "", "NEW_SELECTION")

# Process: Calculate Field
arcpy.CalculateField_management(Input_Points, "EditField", str(value), "PYTHON_9.3")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And if you want to define a 3rd input parameter to select a layer from the map for Selecting_Features, that should be an option available to you --- that's what you have to test to confirm.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:30:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700905#M2327</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T05:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Model converted to Script -  Why Can't it find the field?</title>
      <link>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700906#M2328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for your help Wayne. I still get an error when I try your last solution. I need the selecting features to be something selected by the user, because it will be digitized when the script runs. I am not sure why I am getting an error but I guess you have to refer to layers in your mxd and that would work great in that selection process, but I prefer not to rely on the mxd since this geoproceessing service will be used in a web app. Anyway, this (below) worked for me. It works when I run in ArcMap and I don't get any errors when I run the geoprocessing service, however the feature does not get updated when I run the geoprocessing service, just when I run the script inside arcmap and that's what I need to find out, why would that field not get updated when running the geoprocessing service?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you so much for your help&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Script arguments
Selecting_Features = arcpy.GetParameterAsText(0)
value = arcpy.GetParameterAsText(1)


# Local variables:
Input_Points = "D:\\ArcGISData\\ESRI_GEO_EX\\GDB.gdb\\SamplePoints"
#Final_Output = value

Input_Points_Layer = "SamplePoints_Layer"

# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(Input_Points, Input_Points_Layer)
# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(Input_Points_Layer, "INTERSECT", Selecting_Features, "", "NEW_SELECTION")
Selected_Features = Input_Points_Layer
# Process: Calculate Field



with arcpy.da.UpdateCursor(Selected_Features, ("EditField")) as rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # row comes back as a tuple in the order specified here, so Office is row[0], Forester is row[1]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0] = value
&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;&amp;nbsp;&amp;nbsp; rows.updateRow(row)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:30:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700906#M2328</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2021-12-12T05:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: Model converted to Script -  Why Can't it find the field?</title>
      <link>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700907#M2329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: Wayne_Whitley&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, I see the error now...it's with the expression -- apparently (I always forget about this) it needs to be enclosed in quotes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I included that at your other thread.&amp;nbsp; (Probably duplicate threads should be avoided in the future, okay?)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...so try this, substituting for the expression parameter [from my post above it is 'str(value)']:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;'"' + value + '"'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All that does is add the quotes...let me know if that works.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Oct 2013 15:35:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700907#M2329</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2013-10-01T15:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Model converted to Script -  Why Can't it find the field?</title>
      <link>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700908#M2330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You got it!!! Thank you so much, here is my code with your expression:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# calcfeatures_script.py
# Created on: 2013-09-30 15:22:46.00000
#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)
# Usage: calcfeatures_script &amp;lt;Selecting_Features&amp;gt; &amp;lt;value&amp;gt; 
# Description: 
# test
# ---------------------------------------------------------------------------

# Import arcpy module
import os, sys, arcpy, traceback, arcgisscripting

# Script arguments
Selecting_Features = arcpy.GetParameterAsText(0)
value = arcpy.GetParameterAsText(1)


# Local variables:
Input_Points = "D:\\ArcGISData\\ESRI_GEO_EX\\GDB.gdb\\SamplePoints"
#Final_Output = value

Input_Points_Layer = "SamplePoints_Layer"

# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(Input_Points, Input_Points_Layer)
# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(Input_Points_Layer, "INTERSECT", Selecting_Features, "", "NEW_SELECTION")

# Process: Calculate Field

# Process: Calculate Field
arcpy.CalculateField_management(Input_Points_Layer, "EditField", '"' + value + '"', "PYTHON_9.3")
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:30:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/transportation-questions/model-converted-to-script-nbsp-why-can-t-it-find/m-p/700908#M2330</guid>
      <dc:creator>ionarawilson1</dc:creator>
      <dc:date>2021-12-12T05:30:06Z</dc:date>
    </item>
  </channel>
</rss>

