I want to check if an environmental shapefile was generated from a previous process.
I utilized the Calculate Value tool in Modelbuilder but the problem is that no matter if this Wetlands layer exists or not, it always returns "true". I've tested the code in IDLE and it runs with no issues.
Expression
x("%Wetlands%", "%Workspace%")
Code Block
import arcpy
def x(Wetlands, Workspace):
arcpy.env.workspace = "C:/Omitted/Environmental.gdb"
if arcpy.Exists("Wetlands"):
return "true"
else:
return "false"
Data type
Boolean
1 Answer 1
Should this line:
arcpy.env.workspace = "C:/Omitted/Environmental.gdb"
not be:
arcpy.env.workspace = Workspace
and this line:
if arcpy.Exists("Wetlands"):
be:
if arcpy.Exists(Wetlands):
answered May 6, 2016 at 15:57
lang-py