Skip to content
Snippets Groups Projects
Commit 7bda56da authored by u214892's avatar u214892
Browse files

#163 not running in c

parent be9d33b3
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,8 @@ from importlib_resources import path
from benchmarks.benchmark_utils import swap_attr
print("run_all_examples.py")
for entry in [entry for entry in importlib_resources.contents('examples') if
not pkg_resources.resource_isdir('examples', entry)
and entry.endswith(".py")
......@@ -24,8 +26,11 @@ for entry in [entry for entry in importlib_resources.contents('examples') if
print("Running {}".format(entry))
print("*****************************************************************")
with swap_attr(sys, "stdin", StringIO("q")):
runpy.run_path(file_in, run_name="__main__", init_globals={
'argv': ['--sleep-for-animation=False']
})
try:
runpy.run_path(file_in, run_name="__main__", init_globals={
'argv': ['--sleep-for-animation=False']
})
except Exception as e:
print(e)
print("runpy done.")
print("Done with {}".format(entry))
......@@ -37,9 +37,7 @@ for step in range(100):
i = 0
while i < len(cmds):
if cmds[i] == 'q':
import sys
sys.exit()
break
elif cmds[i] == 's':
obs, all_rewards, done, _ = env.step(action_dict)
action_dict = {}
......@@ -50,5 +48,4 @@ for step in range(100):
action_dict[agent_id] = action
i = i + 1
i += 1
env_renderer.render_env(show=True, frames=True)
env_renderer.render_env(show=True, frames=True)
......@@ -11,7 +11,7 @@ from flatland.utils.rendertools import RenderTool, AgentRenderVariant
os.mkdir("./../render_output/")
for itrials in np.arange(1, 1000, 1):
for itrials in np.arange(1, 15, 1):
print(itrials, "generate new city")
# init seed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment