mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-07-30 20:18:15 +00:00
drop copying the env
This commit is contained in:
parent
f60d6e2f91
commit
fc9b0672c9
1 changed files with 7 additions and 9 deletions
|
|
@ -380,6 +380,8 @@ def check_env(env: gym.Env, warn: bool = True, skip_render_check: bool = True) -
|
|||
|
||||
It also optionally check that the environment is compatible with Stable-Baselines.
|
||||
|
||||
Note that this function eventually calls the close the environment.
|
||||
|
||||
:param env: The Gym environment that will be checked
|
||||
:param warn: Whether to output additional warnings
|
||||
mainly related to the interaction with Stable Baselines
|
||||
|
|
@ -449,12 +451,8 @@ def check_env(env: gym.Env, warn: bool = True, skip_render_check: bool = True) -
|
|||
pass
|
||||
|
||||
# Finally, check that the allows calling `close()` even if the environment was already closed
|
||||
if env.spec is not None:
|
||||
new_env = env.spec.make()
|
||||
new_env.close()
|
||||
try:
|
||||
new_env.close()
|
||||
except Exception as e:
|
||||
warnings.warn(
|
||||
f"Calling `env.close()` on the closed environment should be allowed, but it raised an exception: {e}"
|
||||
)
|
||||
env.close()
|
||||
try:
|
||||
env.close()
|
||||
except Exception as e:
|
||||
warnings.warn(f"Calling `env.close()` on the closed environment should be allowed, but it raised an exception: {e}")
|
||||
|
|
|
|||
Loading…
Reference in a new issue