Prajwal Vinod
Prajwal Vinod

Reputation: 21

SUMO File Locations

Do the configuration files have to be in the same directory/drive where SUMO has been installed like C:/ ? If not will it cause errors while trying to load files through Python using TraCI ?

The reason I ask is that I created a sumo configuration file using net and route files to run through Python. I followed the instructions on the SUMO website. But when I try to run it through python I get the following error.

Retrying in 1 seconds Could not connect to TraCI server at localhost:51818 [WinError 10061] No connection could be made because the target machine actively refused it Retrying in 1 seconds Could not connect to TraCI server at localhost:51818 [WinError 10061] No connection could be made because the target machine actively refused it Retrying in 1 seconds Could not connect to TraCI server at localhost:51818 [WinError 10061] No connection could be made because the target machine actively refused it Retrying in 1 seconds Could not connect to TraCI server at localhost:51818 [WinError 10061] No connection could be made because the target machine actively refused it Retrying in 1 seconds

FatalTraCIError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_14208\2788396650.py in 18 import traci 19 20 traci.start(sumoCmd,traceFile="traci.log") 21 22 traci.close()

C:\Program Files (x86)\Eclipse\Sumo\tools\traci\main.py in start(cmd, port, numRetries, label, verbose, traceFile, traceGetters, stdout, doSwitch) 145 sumoProcess = subprocess.Popen(cmd2, stdout=stdout) 146 try: 147 result = init(sumoPort, numRetries, "localhost", label, sumoProcess, doSwitch, traceFile, traceGetters) 148 if traceFile is not None: 149 connection.get(label).write("start", "%s, port=%s, label=%s" % (repr(cmd), repr(port), repr(label)))

C:\Program Files (x86)\Eclipse\Sumo\tools\traci\main.py in init(port, numRetries, host, label, proc, doSwitch, traceFile, traceGetters) 114 pool concurrently. 115 """ 116 con = connect(port, numRetries, host, proc, 1, traceFile, traceGetters, label) 117 if doSwitch: 118 switch(label)

C:\Program Files (x86)\Eclipse\Sumo\tools\traci\main.py in connect(port, numRetries, host, proc, waitBetweenRetries, traceFile, traceGetters, label) 104 print(" Retrying in %s seconds" % waitBetweenRetries) 105 time.sleep(waitBetweenRetries) 106 raise FatalTraCIError("Could not connect in %s tries" % (numRetries + 1)) 107 108

FatalTraCIError: Could not connect in 61 tries*

The code I am using is the following:

import os, sys
import subprocess
import sumolib

if 'SUMO_HOME' in os.environ:
tools = os.path.join(os.environ['SUMO_HOME'], 'tools')
sys.path.append(tools)
else:
sys.exit("Please declare the environment variable 'SUMO_HOME'")

sumoBinary = "C:/Program Files (x86)/Eclipse/Sumo/bin/sumo-gui.exe"
sumoCmd = [sumoBinary, "-c", "hegyi_net.sumocfg"]

import traci

traci.start(sumoCmd)

traci.close()

SUMO-version: 1.16

operating system: Windows 11

As a result, I tried uninstalling and reinstalling SUMO, running other .sumocfg files, getting log files, and just trying to open the sumo-gui through Python(which works), but it does not open any config files. I just want to ask before I do anything else and cause additional issues which might take longer to solve.

Upvotes: 1

Views: 326

Answers (1)

Michael
Michael

Reputation: 3680

SUMO's config files do not have to be in the installation directory and can also be in a different directory than the referenced files. I suppose you are just not in the correct directory. Try to give the absolute path to the config when loading it.

Upvotes: 0

Related Questions