I was handed off a a bunch of state shapefiles and wrote a script to add a few new fields and calculate some attributes. The first line in my script is -

arcpy.AddField_management('C:\WB_prj\cityPts\ghosts.gdb\vietnam_adm3_citypt_albers_ghost', 'City_cnt', 'SHORT', '#', '#', '#', '#', 'NULLABLE', 'NON_REQUIRED', '#')

I have all of the state shapefiles in a geodatabase. The script runs perfect for some of the files but for others I get an error that is shown below. My pathways are correct and I can manually add the fields through ArcMap but when I try and run the script for some of them I get the error. Any ideas on how to solve this? I'm running ArcGIS 10.0

File "C:\WB_prj\scripts\ghostRegions_final.py", line 79, in add_fields() File "C:\WB_prj\scripts\ghostRegions_final.py", line 14, in add_fields arcpy.AddField_management('C:\WB_prj\cityPts\ghost.gdb\vietnam_adm3_citypt_albers_ghost', 'City_cnt', 'SHORT', '#', '#', '#', '#', 'NULLABLE', 'NON_REQUIRED', '#') File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 2625, in AddField raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Input Table: Dataset C:\WB_prj\cityPts\ghost.gdb ietnam_adm3_citypt_albers_ghost does not exist or is not supported Failed to execute (AddField).

1 Answer 1








Your syntax of 'C:\WB_prj\cityPts\ghosts.gdb\vietnam_adm3_citypt_albers_ghost' will use the single "\" as an escape character and thus not work.

  • I solved this issue by using \\ in the pathway instead of a single \. 'C:\\WB_prj\\cityPts\\ghosts.gdb\\vietnam_adm3_citypt_albers_ghost'
    – SpookyDLX
    Commented Jul 14, 2013 at 20:04
  • Oops - the double slashes out in my second example did not show up due to formatting
    – PolyGeo
    Commented Jul 14, 2013 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.