Permalink
Browse files

allow registering a callable

  • Loading branch information...
joschu committed Sep 18, 2017
1 parent afe0c42 commit 5af5b7958a178b4d44119db53ee5e8eca11b2e19
Showing with 5 additions and 2 deletions.
  1. +5 −2 gym/envs/registration.py
View
@@ -82,8 +82,11 @@ def make(self):
if self._entry_point is None:
raise error.Error('Attempting to make deprecated env {}. (HINT: is there a newer registered version of this env?)'.format(self.id))
cls = load(self._entry_point)
env = cls(**self._kwargs)
elif callable(self._entry_point):
env = self._entry_point()
else:
cls = load(self._entry_point)
env = cls(**self._kwargs)
# Make the enviroment aware of which spec it came from.
env.unwrapped._spec = self

0 comments on commit 5af5b79

Please sign in to comment.