Select to view content in your preferred language

Copy Features Snag

558
3
04-12-2011 07:26 AM
DuncanRager
Deactivated User
Greetings,

I'm writing a basic snap to line script that goes something like this...

## Snap to Line

# import modules
import arcpy, os, sys
from arcpy import env

# grab user inputs
env.workspace = arcpy.GetParameterAsText(0)
snapLine = arcpy.GetParameterAsText(1)
snapType = arcpy.GetParameterAsText(2)
snapDistance = arcpy.GetParameterAsText(3)
fcBackupDir = arcpy.GetParameterAsText(4)

# define variables
fcList = arcpy.ListFeatureClasses()

# make backup copies of features
for fc in fcList:
 fcBackupName = fcBackupDir + fc
 arcpy.CopyFeatures_management(fc, fcBackupName)
 
# set snapping environment
snapEnv1 = [snapLine, snapeType, snapDistance]

# snap to line
for fc in fcList:
 arcpy.Snap_edit(fc, [snapEnv1])


...and I keep getting an error saying...

Runtime error <class 'arcgisscripting.ExecuteError'>: ERROR 000210: Cannot create output C:\GIS\Base\NHD\SGBD\Raw_Shapefiles\Bank_P.shp Failed to execute (CopyFeatures).


Does this have to do with a schema lock? Is my directory syntax off?

Thanks so much,

DR
Tags (2)
0 Kudos
3 Replies
MathewCoyle
Honored Contributor
Did you try these steps?

http://help.arcgis.com/EN/ARCGISDESKTOP/10.0/HELP/index.html#//00vp0000000n000210.htm

Does the file name already exist?
0 Kudos
DuncanRager
Deactivated User
I did see that article. The backup workspace is different, and I tried different names and all came up with the same error.
0 Kudos
DuncanRager
Deactivated User
Fixed it. Turned out to be a syntax error in my snapping environment... I used "snapeType" instead of "snapType".

I guess that's why you're supposed to use Try Except statements.
0 Kudos