AnsweredAssumed Answered

Python Script Help - Spaces in filename

Question asked by gshdet on May 23, 2012
Latest reply on Oct 11, 2013 by rangermry
Hello,

Please can somebody provide some advice?

I am using the code below in a script to add a field to multiple shapefiles, however when the filename or file location contains spaces it does not work. I get the error  message "Input Table: xxxxx does not exist or is not supported"

I think it must have something to do with the LayersList = string.split(arcpy.GetParameterAsText(0),";") line, but as i am new to Python i do not know how to correct it.

It will be greatly appreciated if someone can help me.

Thank you.

James

import arcpy, os, string

#Read input parameters from script tool
LayersList = string.split(arcpy.GetParameterAsText(0),";")

# Process: Add Field
for Layer in LayersList:
arcpy.AddField_management(Layer, "DUP", "DOUBLE", 9, "", "", "Dup", "NULLABLE")

Outcomes