# This script clips all feature classes in a file geodatabase
import arcpy
# Create path variables
sourceWorkspace = r"C:\Users\Lesson2Practice\USA.gdb"
targetWorkspace = r"C:\Users\Lesson2Practice\Iowa.gdb"
clipfeature = r"C:\Users\Lesson2Practice\Iowa.gdb\Iowa"
# Get a list of all feature classes in the USA geodatabase
arcpy.env.workspace = sourceWorkspace
featureClassList = arcpy.ListFeatureClasses()
try:
# Loop through all USA faeture classes
for featureClass in featureClassList:
# Construct the output path
outClipFeatureClass = f'{targetWorkspace}\Iowa{featureClass}'
# Perform Clip
arcpy.Clip_analysis(featureClass,clipfeature,outClipFeatureClass)
arcpy.AddMessage(f'Wrote clipped file {outClipFeatureClass}.')
print(f"Wrote clipped file {outClipFeatureClass}.")
except:
# Report if there was an error
arcpy.AddError("Could not clip feature classes")
print("Could not clip feature classses")
print(arcpy.GetMessages())I have created a python script file that I am debugging it using visual studio 2019, But as soon as I try to debug, it gives me and Exception on another file (time.py - not sure where it came from as this time.py is not in my project or folder) stating "name 'm' is not defined" (I am attaching a video of the exception). Any help is appreciated.
Thanks