Hi,
Adding a terminal configuration works well in ArcGIS Pro interface (v3.1.2), but fails in python with the python command copied from the interface...
I think it is a translation issue (only the alias "ALL" is valid in the python command)
Here is an example of code :
arcpy.un.AddTerminalConfiguration(
in_utility_network=r"D:\...\1_datamodel_00.geodatabase\main.reseau\main.UN",
terminal_configuration_name="Interrupteur bidirectionneld",
traversability_model="BIDIRECTIONAL",
terminals_directional=None,
terminals_bidirectional="1;2",
valid_paths="Tous ALL;Aucun None",
default_path="Tous"
)
--> ERROR
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\un.py", line 4100, in AddTerminalConfiguration
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\un.py", line 4097, in AddTerminalConfiguration
retval = convertArcObjectToPythonObject(gp.AddTerminalConfiguration_un(*gp_fixargs((in_utility_network, terminal_configuration_name, traversability_model, terminals_directional, terminals_bidirectional, valid_paths, default_path), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 002029: Le chemin par défaut de la configuration n’est pas valide.
Échec de l’exécution de (AddTerminalConfiguration).
arcpy.un.AddTerminalConfiguration(
in_utility_network=r"D:\...\1_datamodel_00.geodatabase\main.reseau\main.UN",
terminal_configuration_name="Interrupteur bidirectionneld",
traversability_model="BIDIRECTIONAL",
terminals_directional=None,
terminals_bidirectional="1;2",
valid_paths="ALL All;Aucun None",
default_path="ALL"
)
--> WORKS
Did anyone else experience this ?
In ArcGIS Pro :
Let me rephrase that, you need to set the terminal configuration, such as the terminal names and directionality, but you should not be able to define paths. The paths are always None and All.
Hi,
thank you, it works when not defining valid paths nor default path in the python code :
arcpy.un.AddTerminalConfiguration(
in_utility_network=r"D:\...\1_datamodel_00.geodatabase\main.reseau\main.UN",
terminal_configuration_name="Interrupteur bidirectionnel3",
traversability_model="BIDIRECTIONAL",
terminals_directional=None,
terminals_bidirectional="1;2",
valid_paths="",
default_path=""
)
-> WORKS
But I still think there is a difference between the Pro UI behavior and the code, because in the UI, you can translate the alias of the valid paths (see my 1st screenshot), what you cannot do in the code.
See the result in the UN properties :
There def still can be a bug. Can you try a list of list to see if it is any different?
valid_paths="Tous ALL;Aucun None",
to
valid_paths=[['Tous','ALL'],['Aucun','None']],
Same result with a list of lists for the valid_paths, either setting default_path="Tous" or ="ALL".
Note that when testing others possible values, I had the error :
ERROR 000800: La valeur ne correspond pas à un membre de ALL | NONE.
-> value is not a member of ALL | NONE
I had no problem scripting a 3 terminals configuration