2

I get this Error when trying to run the FeatureClassToFeatureClass_conversion:

Traceback (most recent call last): File "", line 1, in arcpy.FeatureClassToFeatureClass_conversion(inFeatures, outLocation, outFeatureclass) File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\conversion.py", line 1675, in FeatureClassToFeatureClass raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Input Features: Dataset Parcel_Owners does not exist or is not supported Failed to execute (FeatureClassToFeatureClass).

This is my code:

import arcpy
arcpy.env.workspace = "D:\Users\ShawnO\Desktop\PythonExercizes\Parcel_Ownership_update_model\Parcels.gdb"
inFeatures = "D:\Users\ShawnO\Desktop\PythonExercizes\Parcel_Ownership_update_model\Parcels.gdb\Parcel_Owners"
outLocation = "D:\Users\ShawnO\Desktop\PythonExercizes\Parcel_Ownership_update_model\Old_Parcel_Owner\Old_Parcel_Owners.gdb"
outFeatureclass = "old_owners"
arcpy.FeatureClassToFeatureClass_conversion(inFeatures, outLocation, outFeatureclass)

What is wrong with my variable inFeatures? I know that a feature class table consists of more than one file but examples on the internet had the name of the Featureclass as an acceptable input.

  • 1
    Backslashes are escape characters unless escaped, or raw formatting is used. This is a frequent error for new Python users on Windows platforms. You can recognize the problem within Python by testing if os.path.exists() returns True. – Vince Jun 19 '16 at 22:55
3

Try changing:

arcpy.env.workspace = "D:\Users\ShawnO\Desktop\PythonExercizes\Parcel_Ownership_update_model\Parcels.gdb"
inFeatures = "D:\Users\ShawnO\Desktop\PythonExercizes\Parcel_Ownership_update_model\Parcels.gdb\Parcel_Owners"
outLocation = "D:\Users\ShawnO\Desktop\PythonExercizes\Parcel_Ownership_update_model\Old_Parcel_Owner\Old_Parcel_Owners.gdb"

to:

arcpy.env.workspace = r"D:\Users\ShawnO\Desktop\PythonExercizes\Parcel_Ownership_update_model\Parcels.gdb"
inFeatures = "Parcel_Owners"
outLocation = r"D:\Users\ShawnO\Desktop\PythonExercizes\Parcel_Ownership_update_model\Old_Parcel_Owner\Old_Parcel_Owners.gdb"

The main problem is that you need to escape the backslash which is a special character to Python. There are several ways to do this but putting an r before any string containing a pathname with one or more backslashes is my preferred.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.