I am working on an application and I am a beginner in Python :(
I want to add a shapefile, the execution is successful and everything but no result appears on ArcMap, here is the code I use:
import arcpy
try:
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
newlayer1 = arcpy.mapping.Layer(E:\DATA SF\SFcircuit\shape_zizo\batiment.shp")
print newlayer1
arcpy.mapping.AddLayer(df, newlayer1, "TOP")
arcpy.RefreshActiveView()
arcpy.RefreshTOC()
# save the map to persist the added layer
mxd.save()
except Exception as ex:
print ex.args[0]