3

I have a strange bug (?) using arcpy when I try to create a layer with a point inside the name. Let's consider I write:

N = 26.1
outLocation = "C:/Project/ArcGIS/MyLayers/"    
outputName =  "SimpleName_"+str(N)
geometry_type = "POINT"
arcpy.CreateFeatureclass_management(outLocation, outputName, geometry_type)

The layer is created but it gets the name SimpleName_24 instead of SimpleName_24.1

Is it something that can be corrected? I also tried "SimpleName_"+str(N)[:2]+"."+str(N)[3:] but it didn't work.

JrCaspian
  • 241
  • 1
  • 5
  • Are you creating a shapefile or a feature in a geodatabase? – BERA Nov 01 '16 at 12:28
  • 3
    You should really avoid anything but a-z, A-Z, 0-9 and _ in names and paths, especially in combination with Python. Will save you a lot of headaches... – Martin Nov 01 '16 at 12:29

1 Answers1

6

Using "." in feature class name is not supported (invalid). You cannot create a fc with a "." character. Maybe use "_" underscore character instead. Here is a q/a defining naming rules:

What are Valid feature class and table names in ArcGIS Desktop?

artwork21
  • 35,114
  • 8
  • 66
  • 134