Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] TraCI not found

Hello everybody,
This is my python code in the following:


import os
import sys
import traci
   
if 'SUMO_HOME' in os.environ:
     tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
     sys.path.append(tools)
else:
     sys.exit("please declare environment variable 'SUMO_HOME'")
     
from sumolib import checkbinary

sumoBinary = "C:\Program Files (x86)\Eclipse\Sumo\bin\sumo-gui"
sumoCmd = [sumoBinary, "-c", "D:\ali mirzaei\app\my_sumo\ali_trace.sumocfg"]

def run():
   
    traci.start(sumoCmd)
    step = 0
    while step < 1000:
     traci.simulationStep()
     traci.vehicle.add('car','route_0')
     step += 1
traci.close()

after running, it leads to this error:


 File "D:\ali mirzaei\app\my_sumo\untitled0.py", line 4, in <module>
    import traci

ModuleNotFoundError: No module named 'traci'


I've looked it up more or less, but I didn't catch something to fix it.

Thank you if you could help me.



Back to the top