Skip to content
Snippets Groups Projects
Commit 58e86164 authored by Tessaris Sergio's avatar Tessaris Sergio
Browse files

fix: handling invalid gym environment

parent 5e005132
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
import argparse import argparse
import json import json
# Register the Wumpus world environment
import gym_wumpus import gym_wumpus
from gym_wumpus.envs import WumpusEnv from gym_wumpus.envs import WumpusEnv
...@@ -45,7 +46,7 @@ def main(): ...@@ -45,7 +46,7 @@ def main():
except error.Error as e: except error.Error as e:
print('Bad Gym environment {}, using {}. Error is {}'.format(args.id, default_env, e)) print('Bad Gym environment {}, using {}. Error is {}'.format(args.id, default_env, e))
env = make(default_env) env = make(default_env)
if isinstance(env, WumpusEnv): if hasattr(env, 'space_to_percept'):
run_episode(env) run_episode(env)
else: else:
print('Environment {} is not a Wumpus world.'.format(env)) print('Environment {} is not a Wumpus world.'.format(env))
......
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