On Oct 19, 2015, at 3:06 PM, Evan Zheran Liu 
<[email protected]<mailto:[email protected]>> wrote:

Hi Tom,

Thanks for helping me. I looked into runner.py and this is what I see:

# 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')")

Yes, the “sys.path.append” lines (and their continuation lines) need to be 
commented-out.

My original explanation claimed that the first line was already commented-out, 
but that was because I’ve been tracking down other edge-cases and in my test 
build it already was. Not for you though.

In this case you need to retain the “from sumo lib import checkBinary” but get 
rid of the other two sys.path.append lines.

The next problem you will have is that /opt/local/share/doc/sumo is not open 
for writing, and this test program wants to open ./data/cross.rou.xml as output.

If you copy the directory and contents to your own directory:

cd ~
cp -r /opt/local/share/doc/sumo/tutorials/traci_tls .
cd traci_tls
./runner.py

then (if those lines are commented out) it should run for you (it does for me).

btw, if you specify “python runner.py” then you need to make sure that it is 
python2.7 which is what the SUMO port uses.

I’m preparing patches for the port file which will fix this and a few other 
issues but it will likely be a few days before it is accepted, applied, and 
available.

Not sure how to fix the “can’t write to /opt/local/share/doc/sumo” but having 
the tutorials at all is a bonus. However any suggestions on this are 
appreciated.

Feel free to ask about any other issues you run into.

- Tom


import traci

I tried commenting out this line:

sys.path.append(os.path.join(os.environ.get("SUMO_HOME", os.path.join(
        os.path.dirname(__file__), "..", "..", "..")), "tools"))  # tutorial in 
docs

and I also tried commenting out the whole block, but it still isn't working for 
me. Are these the lines that you were referring?

Thanks!
Evan

On Mon, Oct 19, 2015 at 2:50 PM, Lockhart, Thomas G (398I) 
<[email protected]<mailto:[email protected]>> wrote:
On Oct 19, 2015, at 12:53 PM, Evan Zheran Liu 
<[email protected]<mailto:[email protected]>> wrote:

Hi Tom,

Thanks for your help! Specifically what I'm trying to do is follow the tutorial 
given: here http://sumo.dlr.de/wiki/Tutorials/TraCI4Traffic_Lights

I am not sure where to point the environmental variable SUMO_HOME:


rescomp-13-265598:traci_tls Evan$ ls

data        embedded.py runner.py

rescomp-13-265598:traci_tls Evan$ pwd
/opt/local/share/doc/sumo/tutorial/traci_tls
rescomp-13-265598:traci_tls Evan$ python runner.py
please declare environment variable ‘SUMO_HOME' as the root directory of your 
sumo installation (it should contain folders 'bin', 'tools' and 'docs')

I was unable to locate any sumo directory that contains bin, tools and docs. 
I've attached the output of "port contents sumo" to this email under the file 
logfile.txt. Any ideas?

Ah, right. There are a few changes needed in the source code to get it to fit 
into /opt/local/bin/, /opt/local/lib/ etc to remove the need for SUMO_HOME.

In this case, there is a try/except in the runner.py file which has a 
commented-out reference to SUMO_HOME (good) but the line actually extended to 
two lines and the second one caused an error (bad). The only case for the 
except clause warns you to set SUMO_HOME (which is not actually the root cause 
of the problem).

Try modifying runner.py to comment-out the line immediately following the one 
with SUMO_HOME and try again. Let me know if you have additional trouble, and 
I’ll think about how to fix the problem (though it exceeds my sed expertise at 
the moment!).

- Tom



Thanks!
Evan

On Mon, Oct 19, 2015 at 10:12 AM, Lockhart, Thomas G (398I) 
<[email protected]<mailto:[email protected]>> wrote:
Hi. I’m the maintainer of the sumo port, and the python scripts and libraries 
are definitely installed.

What is the symptom of “lacks python support”? Could it be that you are not 
finding a particular script? If so, perhaps it would help to know that all of 
the scripts (over 100 of them) are prefixed with a “sumo-“ to avoid name 
collisions in /opt/local/bin/. Also, underscores in program names are replaced 
by dashes for name consistency.

“port contents sumo” might help you locate what you need, and will give a clue 
about where other files such as libraries are placed.

hth

- Tom

On Oct 19, 2015, at 3:31 AM, Evan Zheran Liu 
<[email protected]<mailto:[email protected]>> wrote:

> Hi,
>
> I'm running on OS X Mavericks. I installed SUMO using MacPorts using (sudo
> port install sumo) but the version that MacPorts gives lacks python support.
>
> I downloaded the src code in the sumo-src-0.24.0.tar.gz, and extracted the
> files. I'm trying to run the configure script, but I keep running into this
> issue:
>
> rescomp-13-265598:sumo-0.24.0 Evan$ ./configure --with-python
> checking build system type... x86_64-apple-darwin13.4.0
> checking host system type... x86_64-apple-darwin13.4.0
> checking target system type... x86_64-apple-darwin13.4.0
> checking for a BSD-compatible install... /usr/bin/install -c
> checking whether build environment is sane... configure: error: unsafe
> absolute working directory name
>
> Can anybody help me out here to configure SUMO? Thanks for your help!
>
> Best,
> Evan
> ------------------------------------------------------------------------------
> _______________________________________________
> sumo-user mailing list
> [email protected]<mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/sumo-user


<logfile.txt>



------------------------------------------------------------------------------
_______________________________________________
sumo-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sumo-user

Reply via email to