From 0ccc333d77404d8332b2c6814bd6989a0e2ff9f2 Mon Sep 17 00:00:00 2001 From: Zach Dwiel Date: Sun, 13 Jan 2019 04:06:48 -0500 Subject: [PATCH] raise value error if there is an invalid action space (#179) --- rl_coach/environments/gym_environment.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rl_coach/environments/gym_environment.py b/rl_coach/environments/gym_environment.py index 9f990a9..7762abb 100644 --- a/rl_coach/environments/gym_environment.py +++ b/rl_coach/environments/gym_environment.py @@ -379,6 +379,11 @@ class GymEnvironment(Environment): num_actions=self.env.action_space.n, descriptions=actions_description ) + else: + raise screen.error(( + "Failed to instantiate gym environment class {} due to unsupported " + "action space {}. Expected BoxActionSpace or DiscreteActionSpace." + ).format(env_class, self.env.action_space), crash=True) if self.human_control: # TODO: add this to the action space