This error may occur if the port is still occupied by another process. You could try using sumolib.miscutils.getFreeSocketPort()
2016-06-17 17:15 GMT+02:00 Frederik Preuß <[email protected]> : > Hi, > > i don't know if you can help me. > I have two different python scripts. > One to start sumo with this function (works very fine): > def runLocal(self): > sumoBinary = "F:/Projektgruppe/Sumo/bin/sumo-gui" > sumoProcess = subprocess.Popen([sumoBinary, "-c", > "F:/Projektgruppe/SVN/PG_SVN/de.uniol.inf.is.odysseus.pgtaxi/scenario/oldenburg.sumocfg", > "--remote-port", str(PORT)], stdout=sys.stdout, stderr=sys.stderr) > > > And one with this function to connect with traci: > def initTraci(self): > tools = "F:/Projektgruppe/Sumo/tools" > sys.path.append(tools) > import traci > traci.init(PORT) > step = 0 > while step < 1000: > traci.simulationStep() > print step > step += 1 > > traci.close() > sys.stdout.flush() > > > At the first step i start the script to run sumo and after this i want to > start the connect script. > Sometimes this works very fine but sometimes i get this error: > > Exception in thread "MainThread" Traceback (most recent call last): > File > "C:\Users\Frederik\workspaceOdysseus\de.uniol.inf.is.odysseus.pgtaxi\src\de\uniol\inf\is\odysseus\pgtaxi\traci\traci4python\connect.py", > line 35, in <module> > conn.initTraci() > File > "C:\Users\Frederik\workspaceOdysseus\de.uniol.inf.is.odysseus.pgtaxi\src\de\uniol\inf\is\odysseus\pgtaxi\traci\traci4python\connect.py", > line 23, in initTraci > traci.init(PORT) > File "F:\Projektgruppe\Sumo\tools\traci\__init__.py", line 65, in init > return getVersion() > File "F:\Projektgruppe\Sumo\tools\traci\__init__.py", line 82, in > getVersion > return _connections[""].getVersion() > AttributeError: 'NoneType' object has no attribute 'getVersion' > > > Especially this error occur if i want to start the script with the python > interpreter in java (later i need the return data in java): > String script_dir = System.getProperty("user.dir"); > script_dir = script_dir + > "\\src\\de\\uniol\\inf\\is\\odysseus\\pgtaxi\\traci\\traci4python\\connect.py"; > RunPython ie = new RunPython(); > ie.execfile(script_dir); > > Greetings > > ------------------------------------------------------------------------------ > What NetFlow Analyzer can do for you? Monitors network bandwidth and > traffic > patterns at an interface-level. Reveals which users, apps, and protocols > are > consuming the most bandwidth. Provides multi-vendor support for NetFlow, > J-Flow, sFlow and other flows. Make informed decisions using capacity > planning > reports. http://sdm.link/zohomanageengine > _______________________________________________ > sumo-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/sumo-user > ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. http://sdm.link/zohomanageengine _______________________________________________ sumo-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sumo-user
