carla icon indicating copy to clipboard operation
carla copied to clipboard

AttributeError: module 'traci' has no attribute 'sumolib'

Open Chionanthus opened this issue 2 years ago • 5 comments

CARLA version: 0.9.13 Platform/OS: Linux

Hi there,

when i use sumo to run a co-simulation example in the carla-0.9.13/Co-Simulation/Sumo/examples folder , and it can run with no error.

But when i use my own .rou.xml file and .sumocfg file to run co-simulation, it said that in /Co-Simulation/Sumo/sumo_integration/sumo_simulation.py", line 304, , `module 'traci' has no attribute 'sumolib'

After i change the line 304 traci.sumolib.net.readNet(net_file) to sumolib.net.readNet(net_file) and no error is reported and the system works normally, and i wanna know is there a small bug in sumo_simulation.py?

image

Chionanthus avatar Aug 01 '22 07:08 Chionanthus

You can try to check the versions of sumo,the new version is different

jy723 avatar Aug 01 '22 10:08 jy723

You can change traci.sumolib.net.readNet to sumolib.net.readNet to fix the error.

DFCui avatar Aug 05 '22 01:08 DFCui

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 02 '23 03:06 stale[bot]

File "/Carla/Co-Simulation/Sumo/sumo_integration/sumo_simulation.py", line 304, in _get_sumo_net sumo_net = traci.sumolib.net.readNet(net_file) AttributeError: module 'traci' has no attribute 'sumolib'

最终是找到了问题所在:

这是因为sumolib是独立的包,不在traci里面,你需要把carla/Co-Simulation/Sumo/sumo_integration/sumo_simulation.py的304行的这一句代码改成sumo_net = sumolib.net.readNet(net_file)

oyontalas avatar Apr 01 '24 11:04 oyontalas