Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

I want to create a folder using an attribute value from a feature

$
0
0
This is my code and the error message received also

Code:

mxd = arcpy.mapping.MapDocument("Current")
df = arcpy.mapping.ListDataFrames(mxd)[0]
fc = "Parcels"
field = "StateName"
cursor = arcpy.SearchCursor(fc)
 for row in cursor:
 val = row.getValue(field)
arcpy.CreateFolder_management("C:\\"+ "\\" + Str(val) + "\\")

Runtime error  Traceback (most recent call last):  File "<string>", line 1, in <module>  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 14477, in CreateFolder    raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000735: Folder Name: Value is required Failed to execute (CreateFolder).

Any suggestions?

Viewing all articles
Browse latest Browse all 2485

Trending Articles