I have a Script Tool set up and its Python code executes properly when I run it outside of ArcGIS Pro.
But when I execute the script tool that the same code is connected to in ArcGIS Pro, it fails in this way:
First condo ARN value is 410822000220226
Exception encountered
ERROR 000358: Invalid expression
Failed to execute (MakeFeatureLayer).
The code leading up to this point is:
def condo_script_tool(cntNewCondos, txtARN, subType, ws):
arcpy.AddMessage("First condo ARN value is " + txtARN)
arcpy.env.overwriteOutput = True
env.workspace = ws
proc_FC = arcpy.CreateFeatureclass_management("in_memory", "condo_proc", "POLYGON", "bc_dev.GIS_ADMIN.parcels")
target_FC = "parcels"
# Put in error trapping in case an error occurs when running tool
try:
# Make a layer from the feature class with only the parcel that has the desired ARN
arcpy.MakeFeatureLayer_management(target_FC, "condos_lyr"," \"ROLLNUM15\" = \'" + txtARN + "\' AND SUBTYPE = "+ str(subType))
...
Now I ask help please on why this code succeeds outside of Pro but fails inside of it. Could the target_FC maybe be the cause of the problem? How can I make it not be?
Thanks,
Justin