Taken from the documentation here TraCI/Interfacing TraCI from Python , I tried to create a simple Python script to open and close Sumo using traci:
cfg = os.path.abspath('..\\..\\..\\output\\scenarios\\batch_2018-11-07T085610\\sID_7\\sID_7.sumocfg')
traci.start(['sumo-gui', '-c', cfg])
print(traci.getVersion())
traci.close()
traci.start()
Sumo is launched but the script gets stuck! --start
flag to the command makes the script continue. But now traci.close()
does not close Sumo as it should: Command 0x7F: Close.Is the documentation I'm using completely out of date?
Output of traci.getVersion()
: (18, 'SUMO 1.0.1')
Thanks
The TraCI documentation refers to the command line version of sumo not to sumo-gui. To get the desired behavior, you need to add --quit-on-end
to the sumo-gui call.