I'm writing a script to create a new folder and then copy a feature class to a shapefile and add the shapefile in the new folder. The folder gets created but the script is failing on the feature class to shapefile conversion line with an error of:
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Output Folder: Dataset Zoning_ does not exist or is not supported
Failed to execute (FeatureClassToShapefile).
My code so far is:
import arcpy, os, datetime
from arcpy import env
# Set Workspace
env.workspace = "C:/GIS_Work"
inputFile = arcpy.GetParameterAsText(0)
outputFile = arcpy.GetParameterAsText(1)
# Create folder with today's date
#dt = str(datetime.datetime.now())
# Set local variables
out_folder_path = "C:/GIS_Work/PropertyAppraiser"
out_name = "Zoning_"
# Execute CreateFolder
arcpy.CreateFolder_management(out_folder_path, out_name)
# Execute Export Feature Class to Shapefile
arcpy.FeatureClassToShapefile_conversion(inputFile, out_name)
Is there something I need to do to the folder to make it able to receive files? I couldn't see anything in the ArcGIS Help that would suggest this, but since the folder is getting created the portion of the error that says "does not exist" wouldn't apply, I would think.
Best Answer
I decided to scrap
arcpy
for the create folder portion of the script and useos.makedirs
instead. That worked much easier for me. My new code is: