Hi,
I think the error is that you are not calling your net (“network” in your example), but the general net element from sumolib:
network= sumolib.net.readNet('RL.net.xml', withInternal=True)
edges=
network.getEdge('6098').getToNode().getID()
Here your code with the changes
import os, sys
import sumolib
from sumolib import net (not needed)
if 'SUMO_HOME' not in os.environ:
SUMO_HOME=os.path.join(os.sep, 'home','sumo')
sys.path.append('SUMO_HOME')
tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
sys.path.append(tools)
from sumolib import checkBinary
sumoBinary = checkBinary('sumo')
sumoBinaryGUI = checkBinary('sumo-gui')
network= sumolib.net.readNet('RL.net.xml', withInternal=True)
edges= net.getEdge('6098').getToNode().getID()
edges=
network.getEdge('6098').getToNode().getID()
print(edges)
Von: sumo-user <sumo-user-bounces@xxxxxxxxxxx> Im Auftrag von
Mohammed Hammam
Gesendet: Freitag, 26. März 2021 06:07
An: Sumo project User discussions <sumo-user@xxxxxxxxxxx>
Betreff: [sumo-user] module 'sumolib.net' has no attribute 'getEdge'
I have a problem when I try to get any information from sumolib, I have checked the sumolib document and followed the steps but I keep getting this error
module 'sumolib.net' has no attribute 'getEdge'
its same for everything, lanes, nodes, etc
I changed my code several times, removed the 'get' word and when I try to call the code I have another error
'module' object is not callable
here is my simple code example:
import os, sys
if 'SUMO_HOME' not in os.environ:
SUMO_HOME=os.path.join(os.sep, 'home','sumo')
sys.path.append('SUMO_HOME')
tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
from sumolib import checkBinary
sumoBinary = checkBinary('sumo')
sumoBinaryGUI = checkBinary('sumo-gui')
network= sumolib.net.readNet('RL.net.xml', withInternal=True)
edges= net.getEdge('6098').getToNode().getID()
my error appears here: net.getEdge('6098').getToNode().getID()