0

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.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Apr 9, 2014 at 13:01

2 Answers 2

0

I decided to scrap arcpy for the create folder portion of the script and use os.makedirs instead. That worked much easier for me. My new code 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.date.today())
newpath = r'C:\GIS_Work\PropertyAppraiser\Zoning_'+dt
if not os.path.exists(newpath): os.makedirs(newpath)
# Execute Export Feature Class to Shapefile
arcpy.FeatureClassToShapefile_conversion(inputFile, newpath)
answered Apr 9, 2014 at 13:54
-1

You may need to add the out_folder_path to out_name. os.path.join(out_folder_path, out_name)

answered Apr 9, 2014 at 13:09

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.