cityflow-project / CityFlow

A Multi-Agent Reinforcement Learning Environment for Large Scale City Traffic Scenario
https://cityflow-project.github.io
Apache License 2.0
789 stars 173 forks source link

cannot open roadnet file #52

Closed ThisIsIsaac closed 5 years ago

ThisIsIsaac commented 5 years ago

Background

I have two sets of copies of config files: config.json, 1x1_roadnet.json, and 1x1_flow.json. One in /home/isaac/gym_cityflow/gym_cityflow/envs/1x1_config and another in /DATA1/isaac/gym_cityflow/gym_cityflow/envs/1x1_config.

1x1_roadnet.json and 1x1_flow.json are exactly identical in both directories and config.json are almost identical except for "dir".

However, instantiating Engine from /home/isaac/gym_cityflow/gym_cityflow/envs/ works fine while doing the same under /DATA1/isaac/gym_cityflow/gym_cityflow/envs/ doesn't work.


config.json

the contents of config.json are:

/DATA1/isaac/gym_cityflow/gym_cityflow/envs/1x1_config/config.json

{
        "interval": 1.0,
        "seed": 1,
        "dir": "/DATA1/isaac/gym_cityflow/gym_cityflow/envs/1x1_config",
        "roadnetFile": "1x1_roadnet.json",
        "flowFile": "1x1_flow.json",
        "rlTrafficLight": true,
        "saveReplay": true,
        "roadnetLogFile": "roadnetlog.json",
        "replayLogFile": "replay.txt",
        "laneChange": false
}

and /home/isaac/gym_cityflow/gym_cityflow/envs/1x1_config/config.json

{
        "interval": 1.0,
        "seed": 1,
        "dir": "/home/isaac/gym_cityflow/gym_cityflow/envs/1x1_config/",
        "roadnetFile": "1x1_roadnet.json",
        "flowFile": "1x1_flow.json",
        "rlTrafficLight": true,
        "saveReplay": true,
        "roadnetLogFile": "roadnetlog.json",
        "replayLogFile": "replay.txt",
        "laneChange": false
}

you can see that both config.json files are identical, except for "dir".


1x1_roadnet.json and 1x1_flow.json

both copies of 1x1_roadnet.json and 1x1_flow.json are exactly identical. They are created from: python generate_grid_scenario.py 1 1 --roadnetFile 1x1_roadnet.json --flowFile 1x1_flow.json --dir . --tlPlan --numLeftLanes 2 --numRightLanes 1 --numStraightLanes 5 --turn.


Error

When I start python interpreter under /home/isaac/gym_cityflow/gym_cityflow/envs and:

>>> import cityflow
>>> eng = cityflow.Engine("1x1_config/config.json")

I get no error and Engine is instantiated correctly.

However, when I do the same under /DATA1/isaac/gym_cityflow/gym_cityflow/envs, I get:

>>> import cityflow
>>> eng = cityflow.Engine("1x1_config/config.json")
cannot open roadnet file
loading roadnet file error!
load config failed!
soodoshll commented 5 years ago

In /DATA1/isaac/gym_cityflow/gym_cityflow/envs/1x1_config/config.json, add a slash to the end of dir, that is,

"dir": "/DATA1/isaac/gym_cityflow/gym_cityflow/envs/1x1_config/"

I hope this will help.

ThisIsIsaac commented 5 years ago

Wow, I can't believe I've missed that. Thanks so much!

maymuona commented 4 years ago

hello, please i need help with this error and it would be kind of you if you guide me how to use this project and what should be the output this is what i have done to have the loading error

maymouna@DAUBSUMOTST001:~$ docker run -it cityflowproject/cityflow:latest root@c2b5881a626d:/# cd home root@c2b5881a626d:/home# cd cityflow/ root@c2b5881a626d:/home/cityflow# cd examples/ root@c2b5881a626d:/home/cityflow/examples# ls config.json flow.json roadnet.json root@c2b5881a626d:/home/cityflow/examples# pythin bash: pythin: command not found root@c2b5881a626d:/home/cityflow/examples# python Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) [GCC 7.2.0] on linux Type "help", "copyright", "credits" or "license" for more information.

import cityflow eng = cityflow.Engine("config.json") cannot open roadnet file loading roadnet file error! load config failed!