Converting feature set into feature class or layer

3161
1
03-12-2012 11:41 AM
RahulBhosle
New Contributor
Hi All,

I am making a script tool in which I want to convert a parameter whose data type is feature set, to a feature class. I used these three lines in the code but I am getting an error saying that the object was not created.

input = sys.argv[1] # Input from the script tool
obj = arcpy.CreateObject(featureset, input) # Creating a feature set object
obj.save("C:\Users\rbhosle\Desktop\Project_540\Interagency_Compliance\output.shp") #saving the feature set in a shapefile format

Could somebody tell me where I am going wrong?

Thanks.
0 Kudos
1 Reply
markdenil
Regular Contributor II
Is your input variable holding something apprporiate to CreateObject?
Have you tried using arcpy.FeatureSet(input)
or
arcpy.FeatureSet() followed by ~.load(input) and then ~.save(path)?

It would be a good idea to make the save path a raw string:
obj.save(r"C:\Users\rbhosle\Desktop\Project_540\Interagency_Compliance\output.shp")
otherwise single backslashes are interpreted as escapes.
0 Kudos