4

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

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked May 6, 2016 at 14:36

1 Answer 1

5

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
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.