As my title says, I am currently trying to make my (working) standalone script into an ArcGIS tool so I'm not the only person in my office that can use it. It essentially selects all the data within a specified location and copies it to a new geodatabase. Since replacing my old variables with sys.argv[#], new errors keep popping up. The following section of code is giving me problems right now:
out_folder_path_gdb = sys.argv[1]
out_name_gdb = sys.argv[2]
out_name_fc = "buffer_point"
geometry_type = "POINT"
has_m = "DISABLED"
has_z = "DISABLED"
sr = sys.argv[3]
fc = out_folder_path_gdb + "\\" + out_name_gdb + "\\" + out_name_fc
lyrlst = []
######################
# Create geodatabase #
######################
try:
arcpy.CreateFileGDB_management(out_folder_path_gdb, out_name_gdb)
except:
print "Geodatabase already exists."
arcpy.AddIDMessage("Error", 12, out_name_gdb)
sys.exit(0)
##########################
# Create point to buffer #
##########################
arcpy.env.overwriteOutput = True
arcpy.CreateFeatureclass_management(out_folder_path_gdb + "\\" + out_name_gdb, out_name_fc, geometry_type, "", has_m, has_z, sr)
############################################
# Sets given coordinates as a point object #
############################################
rowInserter = arcpy.InsertCursor(fc)
x = sys.argv[4]
y = sys.argv[5]
pointGeometry = arcpy.Point(x,y)
When running the tool within Arc, I get the following error: : Failed to execute. Parameters are not valid. ERROR 000732: Feature Class Location: Dataset C:\Documents and Settings\benoyn\Desktop\DaS GIS work\data_extraction_test\pleasepleaseplease does not exist or is not supported Failed to execute (CreateFeatureclass).
The only reason I can think of for this error is the spaces in "Documents and Settings". Thanks everyone!