<?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 ArcPro script doesn't run all processes in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpro-script-doesn-t-run-all-processes/m-p/709589#M55010</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a script that I am trying to move over to Pro but some process in the script don't run. The script has about 7 process, the script does not fail but it doesn't finish the last process witch applies smbologyfromlayer. For example the last process doesn't run when I run the script but if copy it into Pro's python window and hit enter it runs fine, it updates the symbology. I have tried reload(arcpy) and arcpy.ClearWorkspaceCache_management() before the arcpy.ApplySymbologyFromLayer_management process but it still doesn't work. Not sure what I am missing or not doing...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import arcpy, string, os
from importlib import reload


arcpy.env.overwriteOutput = True

aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps()[0]
lyr = m.listLayers("TAXLOTS")[0]
lyt = aprx.listLayouts("Layout1")[0]
mf = lyt.listElements("MAPFRAME_ELEMENT")[0]

arcpy.env.workspace = os.path.dirname(aprx.filePath)
wp = os.path.dirname(aprx.filePath)

#selects PinID from TAXLOTS
values = arcpy.GetParameterAsText(0)
fieldName = "PinID"
values = values.split(";")  # split values into list
values = ["'{0}'".format(v) for v in values] # add single quotes
whereClause = "{0} IN ({1})".format(fieldName, ",".join(values))
arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", whereClause)

#Udpates Text Element Template from layout
Name = arcpy.GetParameterAsText(1)
for lyt in aprx.listLayouts():
    for elm in lyt.listElements("TEXT_ELEMENT","Text"):
        if elm.text == "Template":
            elm.text = (Name)


#Zooms to selected parcel in layout
ext = mf.getLayerExtent(lyr)
mf.camera.setExtent(ext)
mf.camera.scale *= 15 

#Exports the selected parcels for SUBJECT_PROPERTY.
if int(arcpy.GetCount_management("TAXLOTS").getOutput(0)) &amp;gt; 0:
   arcpy.Select_analysis("TAXLOTS", "SUBJECT_PROPERTY")
arcpy.SelectLayerByAttribute_management("TAXLOTS", "CLEAR_SELECTION")


#Remove layer
for m in aprx.listMaps():
    print("Map: {0} Layers".format(m.name))
    for lyr in m.listLayers("SUBJECT_PROPERTY"):
        m.removeLayer(lyr)

#Add layer Subject_property
arcpy.env.workspace = os.path.dirname(aprx.filePath)
wp = os.path.dirname(aprx.filePath)
shp_path = wp + '\\' + "SUBJECT_PROPERTY.shp"
map = aprx.listMaps()[0]  # assumes data to be added to first map listed
map.addDataFromPath(shp_path)

reload(arcpy)
arcpy.ClearWorkspaceCache_management()

#Update Subject Property symbology
#arcpy.env.workspace = os.path.dirname(aprx.filePath)
#wp = os.path.dirname(aprx.filePath)
#This arcpy.ApplySymbologyFromLayer_management doesn't update the layer symbology in the script
arcpy.ApplySymbologyFromLayer_management("SUBJECT_PROPERTY", wp + '\\'+ "Symbology_SUBJECT_PROPERTY.lyrx")
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SP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SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I copy the last process into Pro python window in the same project and run it, it does update the symbology.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;#Update Subject Property symbology
aprx = arcpy.mp.ArcGISProject("CURRENT")
arcpy.env.workspace = os.path.dirname(aprx.filePath)
wp = os.path.dirname(aprx.filePath)

arcpy.ApplySymbologyFromLayer_management("SUBJECT_PROPERTY", wp + '\\'+ "Symbology_SUBJECT_PROPERTY.lyrx")
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 06:25:29 GMT</pubDate>
    <dc:creator>2Quiker</dc:creator>
    <dc:date>2021-12-12T06:25:29Z</dc:date>
    <item>
      <title>ArcPro script doesn't run all processes</title>
      <link>https://community.esri.com/t5/python-questions/arcpro-script-doesn-t-run-all-processes/m-p/709589#M55010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a script that I am trying to move over to Pro but some process in the script don't run. The script has about 7 process, the script does not fail but it doesn't finish the last process witch applies smbologyfromlayer. For example the last process doesn't run when I run the script but if copy it into Pro's python window and hit enter it runs fine, it updates the symbology. I have tried reload(arcpy) and arcpy.ClearWorkspaceCache_management() before the arcpy.ApplySymbologyFromLayer_management process but it still doesn't work. Not sure what I am missing or not doing...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;import arcpy, string, os
from importlib import reload


arcpy.env.overwriteOutput = True

aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps()[0]
lyr = m.listLayers("TAXLOTS")[0]
lyt = aprx.listLayouts("Layout1")[0]
mf = lyt.listElements("MAPFRAME_ELEMENT")[0]

arcpy.env.workspace = os.path.dirname(aprx.filePath)
wp = os.path.dirname(aprx.filePath)

#selects PinID from TAXLOTS
values = arcpy.GetParameterAsText(0)
fieldName = "PinID"
values = values.split(";")  # split values into list
values = ["'{0}'".format(v) for v in values] # add single quotes
whereClause = "{0} IN ({1})".format(fieldName, ",".join(values))
arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", whereClause)

#Udpates Text Element Template from layout
Name = arcpy.GetParameterAsText(1)
for lyt in aprx.listLayouts():
    for elm in lyt.listElements("TEXT_ELEMENT","Text"):
        if elm.text == "Template":
            elm.text = (Name)


#Zooms to selected parcel in layout
ext = mf.getLayerExtent(lyr)
mf.camera.setExtent(ext)
mf.camera.scale *= 15 

#Exports the selected parcels for SUBJECT_PROPERTY.
if int(arcpy.GetCount_management("TAXLOTS").getOutput(0)) &amp;gt; 0:
   arcpy.Select_analysis("TAXLOTS", "SUBJECT_PROPERTY")
arcpy.SelectLayerByAttribute_management("TAXLOTS", "CLEAR_SELECTION")


#Remove layer
for m in aprx.listMaps():
    print("Map: {0} Layers".format(m.name))
    for lyr in m.listLayers("SUBJECT_PROPERTY"):
        m.removeLayer(lyr)

#Add layer Subject_property
arcpy.env.workspace = os.path.dirname(aprx.filePath)
wp = os.path.dirname(aprx.filePath)
shp_path = wp + '\\' + "SUBJECT_PROPERTY.shp"
map = aprx.listMaps()[0]  # assumes data to be added to first map listed
map.addDataFromPath(shp_path)

reload(arcpy)
arcpy.ClearWorkspaceCache_management()

#Update Subject Property symbology
#arcpy.env.workspace = os.path.dirname(aprx.filePath)
#wp = os.path.dirname(aprx.filePath)
#This arcpy.ApplySymbologyFromLayer_management doesn't update the layer symbology in the script
arcpy.ApplySymbologyFromLayer_management("SUBJECT_PROPERTY", wp + '\\'+ "Symbology_SUBJECT_PROPERTY.lyrx")
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPA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PAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I copy the last process into Pro python window in the same project and run it, it does update the symbology.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;#Update Subject Property symbology
aprx = arcpy.mp.ArcGISProject("CURRENT")
arcpy.env.workspace = os.path.dirname(aprx.filePath)
wp = os.path.dirname(aprx.filePath)

arcpy.ApplySymbologyFromLayer_management("SUBJECT_PROPERTY", wp + '\\'+ "Symbology_SUBJECT_PROPERTY.lyrx")
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 06:25:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpro-script-doesn-t-run-all-processes/m-p/709589#M55010</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2021-12-12T06:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro script doesn't run all processes</title>
      <link>https://community.esri.com/t5/python-questions/arcpro-script-doesn-t-run-all-processes/m-p/1001976#M59065</link>
      <description>&lt;P&gt;It appears that the toolbox script has issues in Pro python, this same script runs fine in ArcMap.&lt;/P&gt;&lt;P&gt;I got past the Symobology by deleting&amp;nbsp; m, lyr, lyt, mt after the first process but I had to re-add them before the Symobology process. Not sure why it's holding on to these, is there a way to clear the processes in Pro?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Changed the last process of ApplySymobologyFromLayer_Managment to Add field&lt;/P&gt;&lt;P&gt;#Add field to lyr&lt;BR /&gt;SP = "SUBJECT_PROPERTY"&lt;BR /&gt;arcpy.AddField_management(SP,"BUFF_DIST","DOUBLE")&lt;/P&gt;&lt;P&gt;&amp;nbsp;SP is a layer that is created by the first process and is in my layout in Pro, it's not being used by any process other than it's in the current layout . I do see 4 "SUBJECT_PROPERTY.shp.*****.11336.8984.sr.lock" in the explorer.&lt;/P&gt;&lt;P&gt;Error after trying to use Add Field with the same script;&lt;/P&gt;&lt;P&gt;ERROR 000464: Cannot get exclusive schema lock. Either being edited or in use by another application or service.&lt;BR /&gt;Failed to execute (AddField).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 23:48:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpro-script-doesn-t-run-all-processes/m-p/1001976#M59065</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2020-11-16T23:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro script doesn't run all processes</title>
      <link>https://community.esri.com/t5/python-questions/arcpro-script-doesn-t-run-all-processes/m-p/1003705#M59096</link>
      <description>&lt;P&gt;Its a little difficult to understand your code since it isn't formatted.&lt;/P&gt;&lt;P&gt;It does appear that you are trying to run the tool inside Pro using the "CURRENT" project (in what looks like it might be the 4th line).&amp;nbsp; But I'm not sure that you are using the current project when attempting to update the symbology.&lt;/P&gt;</description>
      <pubDate>Sat, 21 Nov 2020 04:57:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpro-script-doesn-t-run-all-processes/m-p/1003705#M59096</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2020-11-21T04:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPro script doesn't run all processes</title>
      <link>https://community.esri.com/t5/python-questions/arcpro-script-doesn-t-run-all-processes/m-p/1006278#M59195</link>
      <description>&lt;P&gt;Sorry about that, I didn't see the option to address the syntax. Even after select Python as the syntax there is not numbers for each row.&lt;/P&gt;&lt;P&gt;The following is given me an error and it seems no what I do the script always stops at a certain process no matter if I change the process.&lt;/P&gt;&lt;P&gt;but I just run just the #Creat SelParsA1 section in the projects python window it will run but not in the script so I am not sure what I am doing wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy, string, os
from importlib import reload

#Zooms to selected parcel in layout
#arcpy.env.addOutputsToMap = True
arcpy.env.overwriteOutput = True

aprx = arcpy.mp.ArcGISProject("CURRENT")
map = aprx.listMaps()[0]
lyr = map.listLayers("TAXLOTS")[0]
lyt = aprx.listLayouts()[0]
mf = lyt.listElements("MAPFRAME_ELEMENT")[0]

arcpy.env.workspace = os.path.dirname(aprx.filePath)
wp = os.path.dirname(aprx.filePath)

values = arcpy.GetParameterAsText(0)
fieldName = "DXF_TEXT"
values = values.split(";")  # split values into list
values = ["'{0}'".format(v) for v in values] # add single quotes
whereClause = "{0} IN ({1})".format(fieldName, ",".join(values))
arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", whereClause)

Name = arcpy.GetParameterAsText(1)
for lyt in aprx.listLayouts():
    for elm in lyt.listElements("TEXT_ELEMENT","Text"):
        if elm.text == "Template":
            elm.text = (Name)

#Zooms to selected parcel
ext = mf.getLayerExtent(lyr)
mf.camera.setExtent(ext)
mf.camera.scale *= 16 

#Exports the selected parcels for SUBJECT_PROPERTY.
if int(arcpy.GetCount_management("TAXLOTS").getOutput(0)) &amp;gt; 0:
   arcpy.Select_analysis("TAXLOTS", "SUBJECT_PROPERTY")
arcpy.SelectLayerByAttribute_management("TAXLOTS", "CLEAR_SELECTION")

#Update Subject Property symbology
#layer = m.listLayers('SUBJECT_PROPERTY')[0]
#arcpy.ApplySymbologyFromLayer_management(str(layer), "Symbology_SUBJECT_PROPERTY.lyrx")

del aprx, map, lyr, mf, lyt
'''
#Remove layer Subject property
aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps()[0]# assumes data to be added to first map listed
lyr = m.listLayers()[0]
m.removeLayer(lyr)

del aprx, m,lyr,
'''
#Udpate Subject Property datasource
aprx = arcpy.mp.ArcGISProject("CURRENT")
map = aprx.listMaps()[0]
lyt = aprx.listLayouts()[0]
lyr = map.listLayers("SUBJECT_PROPERTY")[0]
mf = lyt.listElements("MAPFRAME_ELEMENT",'*')[0]

try:
    cp = lyr.connectionProperties
    cp['connection_info']['database'] = wp
    cp['dataset'] = 'SUBJECT_PROPERTY.shp'
    lyr.updateConnectionProperties(lyr.connectionProperties, cp)
except:
    pass

del aprx, map, lyt, lyr, mf

reload(arcpy)
arcpy.ClearWorkspaceCache_management()

#Creat SelParsA1
aprx = arcpy.mp.ArcGISProject("CURRENT")
map = aprx.listMaps()[0]
lyt = aprx.listLayouts()[0]
lyr = map.listLayers("SUBJECT_PROPERTY")[0]
mf = lyt.listElements("MAPFRAME_ELEMENT",'*')[0]

arcpy.env.workspace = os.path.dirname(aprx.filePath)
wp = os.path.dirname(aprx.filePath)

TAX = "TAXLOTS"
SP2 = "SUBJECT_PROPERTY" 
arcpy.SelectLayerByLocation_management(TAX, "WITHIN_A_DISTANCE", SP2, "600 Feet", "NEW_SELECTION")

try:
    if int(arcpy.GetCount_management("TAXLOTS").getOutput(0)) &amp;gt; 0:
        arcpy.SelectLayerByAttribute_management("TAXLOTS", "REMOVE_FROM_SELECTION", "DXF_TEXT = ' ' OR DXF_TEXT IS NULL") #"\"DXF_TEXT\" = ' '"

        arcpy.FeatureClassToFeatureClass_conversion("TAXLOTS", wp, "SelParsA1")

except:
    pass
arcpy.SelectLayerByAttribute_management("TAXLOTS", "CLEAR_SELECTION")

del lyr

lyr = map.listLayers("SelParsA1")[0]

try:
    cp = lyr.connectionProperties
    cp['connection_info']['database'] = wp
    cp['dataset'] = 'SelParsA1.shp'
    lyr.updateConnectionProperties(lyr.connectionProperties, cp)
except:
    pass&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Traceback (most recent call last):
  File "D:\GIS Folder\Python_ArcGISPro\NotificationMapScripts\NotificationMapScriptTest_E.py", line 86, in &amp;lt;module&amp;gt;
    arcpy.SelectLayerByLocation_management(TAX, "WITHIN_A_DISTANCE", SP2, "600 Feet", "NEW_SELECTION")
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 8909, in SelectLayerByLocation
    raise e
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 8906, in SelectLayerByLocation
    retval = convertArcObjectToPythonObject(gp.SelectLayerByLocation_management(*gp_fixargs((in_layer, overlap_type, select_features, search_distance, selection_type, invert_spatial_relationship), True)))
  File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 511, in &amp;lt;lambda&amp;gt;
    return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError:  ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
 The base table definition string "SUBJECT_PROPERTY" is invalid.
The database was not found.
Failed to execute (SelectLayerByLocation).
 Failed to execute (NotificatonMapScript).&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Runs in projects python window but not not included in the script posted above&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy, string, os
from importlib import reload

aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps()[0]
lyt = aprx.listLayouts()[0]
lyr = m.listLayers("SUBJECT_PROPERTY")[0]
mf = lyt.listElements("MAPFRAME_ELEMENT",'*')[0]

arcpy.env.workspace = os.path.dirname(aprx.filePath)
wp = os.path.dirname(aprx.filePath)

TAX = "TAXLOTS"
SP2 = "SUBJECT_PROPERTY" 
arcpy.SelectLayerByLocation_management(TAX, "WITHIN_A_DISTANCE", SP2, "600 Feet", "NEW_SELECTION")

try:
    if int(arcpy.GetCount_management("TAXLOTS").getOutput(0)) &amp;gt; 0:
        arcpy.SelectLayerByAttribute_management("TAXLOTS", "REMOVE_FROM_SELECTION", "DXF_TEXT = ' ' OR DXF_TEXT IS NULL") #"\"DXF_TEXT\" = ' '"

        arcpy.FeatureClassToFeatureClass_conversion("TAXLOTS", wp, "SelParsA1")

except:
    pass
arcpy.SelectLayerByAttribute_management("TAXLOTS", "CLEAR_SELECTION")

del lyr&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 19:18:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpro-script-doesn-t-run-all-processes/m-p/1006278#M59195</guid>
      <dc:creator>2Quiker</dc:creator>
      <dc:date>2020-12-02T19:18:41Z</dc:date>
    </item>
  </channel>
</rss>

