Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Problem with python code

Hi everyone,
I don't know why I am not able to run my file from python while it works normally from GUI.
Here is my simple code:

  1. if 'SUMO_HOME' in os.environ:
  2.      tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
  3.      sys.path.append(tools)
  4. else:
  5.      sys.exit("please declare environment variable 'SUMO_HOME'")from sumolib import checkBinary
  6. from sumolib import checkBinary 
  7. sumoBinary = checkBinary('sumo-gui')
  8. sumoCmd = [sumoBinary, "-c", "ali_trace.sumocfg"]
  9. import traci
  10. traci.start(sumoCmd)
  11. step = 0
  12. while step < 100:
  13.  traci.simulationstep()
  14. step += 1
  15. traci.close()
The GUI is opened but nothing is shown as expected simulation. Just these messages are added at the bottom of GUI:

***Starting server on port 6269 ***
Loading net-file from 'D:\ali mirzaei\app\my_sumo\ali_trace.net.xml' ... done (3ms).
Loading is done.
Simulation started with time: 0.00
 
I would be thankful if one can help me.
Regards,
Ali

Back to the top