I want to make changes in a feature attribute table that is an edge source of a Network dataset. In the next step, I need to rebuild the Network to make the changes take efect.
The problem is that, when I open the editor session and make changes in attribute table, then when I want to close the session the script crashes.
Here is a sample of my code:
import arcpy
from arcpy import env
arcpy.CheckOutExtension("Network")
gdb = r"C:\GDB\NetworkGDB.gdb"
env.workspace = gdb
env.overwriteOutput = True
edt = arcpy.da.Editor(gdb)
edt.startEditing(False,False)
WHERE = '"OBJECTID_12" = 2'
direcao = "yes" #This value was set by another process that's indeppend on this one... Inclusive I tried a fixed value like in this example
with arcpy.da.UpdateCursor("Network_nd_roads",["OBJECTID_12","osm_oneway"], WHERE) as cursor:
for lin in cursor:
txtLog = "Change value from " + lin[1] + " to " + direcao
escreverArquivoLog(logFile,txtLog) #function to write a logfile
lin[1] = direcao
cursor.updateRow(lin)
escreverArquivoLog(logFile,"Change suceed!!!")
escreverArquivoLog(logFile,u"Closing edition...")
edt.stopEditing(True) #-----HERE HAPPENS THE ERROR!!------