diff --git a/examples/simple_example_city_railway_generator.py b/examples/simple_example_city_railway_generator.py index ce96932ccf49c9d71a97431bd0bdabd4cdeaf576..4182bc27128469c72ba8e2246645d629070eaf20 100644 --- a/examples/simple_example_city_railway_generator.py +++ b/examples/simple_example_city_railway_generator.py @@ -9,7 +9,9 @@ from flatland.envs.rail_generators_city_generator import city_generator from flatland.envs.schedule_generators import city_schedule_generator from flatland.utils.rendertools import RenderTool, AgentRenderVariant -os.mkdir("./../render_output/") +OUTPUT_DIR = "./../render_output/" +if not os.path.exists(OUTPUT_DIR): + os.mkdir(OUTPUT_DIR) for itrials in np.arange(1, 15, 1): print(itrials, "generate new city") @@ -52,7 +54,7 @@ for itrials in np.arange(1, 15, 1): # store rendered file into render_output if the path exists env_renderer.gl.save_image( os.path.join( - "./../render_output/", + OUTPUT_DIR, "flatland_frame_{:04d}.png".format(itrials) ))