0
import arcpy
fc = r'H:\H-ONUS UTILITY DATA GIS\As_Builts\2014\RandolphPoint_Phase2\789-AS-BUILT 8-7-13.dwg\Polyline'
out_gdb = r'H:\H-ONUS UTILITY DATA GIS\As_Builts\2014\RandolphPoint_Phase2\RandolphPoint.gdb.gdb'
field = 'Layer'
values = [row[0] for row in arcpy.da.SearchCursor(fc, (field))]
uniqueValues = set(Values)

for value in uniqueValues:
    sql = """Layer" = '{0}'""".format(Value)
    name = arcpy.ValidateTableName(value,out_gdb)
    arcpy.FeatureClassToFeatureClass_conversion(fc, out_gdb, name, sql)

I am trying to convert CAD(dwg) to ArcGIS 10.2.2 Feature Classes using a file geodatase as the workspace. I was just taught this code at an ESRI conference and of course it worked beautifully for the insturtor.
My error I am getting is "NameError:name'Values' is not defined" however I did define it as values = [row[0] for row in arcpy.da.SearchCursor(fc, (field))] I have been working hours on this, it would help out my job considerably.

2 Answers2

0

Python variables are case-sensitive.

You've declared values with a lower-case v, but you're referring to it on the next line with an upper-case V.

(Same with value/Value further down.

Juffy
  • 1,220
  • 13
  • 22
  • Thank you I didn't catch that, however I just changed and it and still the same error. – Nichole May 12 '14 at 18:40
  • Can you update your post, please? (You might get some help from more competent Python people if you tag it with `python` too :) ) – Juffy May 12 '14 at 23:45
  • how do I update it? I just added the python tag. This is my first time using the site and I am new to Python, took some ESRI classes but need much more training. – Nichole May 14 '14 at 15:13
0
import arcpy
fc = r'H:\H-ONUS UTILITY DATA GIS\As_Builts\2014\RandolphPoint_Phase2\789ASBUILT.dwg\Polyline'
out_gdb = r'H:\H-ONUS UTILITY DATA GIS\As_Builts\2014\RandolphPoint_Phase2\RandolphPoint.gdb'
field = 'Layer'
value = [row[0] for row in arcpy.da.SearchCursor(fc, (field))]
uniquevalues = set(value)

for value in uniquevalues:
    sql = """"Layer" = '{0}'""".format(value)
    name = arcpy.ValidateTableName(value,out_gdb)
    arcpy.FeatureClassToFeatureClass_conversion(fc, out_gdb, name, sql)

Here is the solution, I had an extra .gdb in the geodatabase path

my word value was values so had to take the s off

and also in my sql statement I was missing a " before the word Layer

If anyone is reading this just change the individual parameters and it works beautifully!

thanks Juffy for responding and trying to help me out

Cartogal