def __init__(self, env): super(Wrapper, self).__init__(env) if not env.metadata.get('runtime.vectorized'): if self.autovectorize: # Circular dependency :( from universe import wrappers env = wrappers.Vectorize(env) else: raise Exception('This wrapper can only wrap vectorized envs (i.e. where env.metadata["runtime.vectorized"] = True), not {}. Set "self.autovectorize = True" to automatically add a Vectorize wrapper.'.format(env)) self.env = env
def __init__(self, env=None): super(Wrapper, self).__init__(env) if env is not None and not env.metadata.get('runtime.vectorized'): if self.autovectorize: # Circular dependency :( from universe import wrappers env = wrappers.Vectorize(env) else: raise error.Error( 'This wrapper can only wrap vectorized envs (i.e. where env.metadata["runtime.vectorized"] = True), not {}. Set "self.autovectorize = True" to automatically add a Vectorize wrapper.' .format(env)) if env is None and not self.standalone: raise error.Error( 'This env requires a non-None env to be passed. Set "self.standalone = True" to allow env to be omitted or None.' ) self.env = env