I have the following part of my code where I have a problem:
import os, sys
import optparse
import subprocess
import random
# we need to import python modules from the $SUMO_HOME/tools directory
try:
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', "tools")) # tutorial in tests
sys.path.append(os.path.join(os.environ.get("$SUMO_HOME", os.path.join(os.path.dirname(__file__), "..", "..", "..")), "tools")) # tutorial in docs
from sumolib import checkBinary
except ImportError:
sys.exit("please declare environment variable 'SUMO_HOME' as the root directory of your sumo installation (it should contain folders 'bin', 'tools' and 'docs')")
import traci
I declared SUMO_HOME as a system variable, but when I run this script I get the ImportError. Do you have any idea what the problem is?
os.environ.get('SUMO_HOME'), notos.environ.get('$SUMO_HOME').os.environ.get('SUMO_HOME')in the script display the correct path?