From ab5a81c7ee0a4399a4f2e3e785893824732c189c Mon Sep 17 00:00:00 2001 From: Gal Leibovich Date: Tue, 14 Aug 2018 18:13:44 +0300 Subject: [PATCH] fix for dumping movies, without rendering, for pendulum_with_goals --- rl_coach/environments/gym_environment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rl_coach/environments/gym_environment.py b/rl_coach/environments/gym_environment.py index 5e1f0c4..2a6db97 100644 --- a/rl_coach/environments/gym_environment.py +++ b/rl_coach/environments/gym_environment.py @@ -425,7 +425,8 @@ class GymEnvironment(Environment): :param camera_idx: The index of the camera to use. Should be defined in the model :return: None """ - if self.env.unwrapped.viewer.cam.fixedcamid != camera_idx and self.env.unwrapped.viewer._ncam > camera_idx: + if self.env.unwrapped.viewer is not None and self.env.unwrapped.viewer.cam.fixedcamid != camera_idx and\ + self.env.unwrapped.viewer._ncam > camera_idx: from mujoco_py.generated import const self.env.unwrapped.viewer.cam.type = const.CAMERA_FIXED self.env.unwrapped.viewer.cam.fixedcamid = camera_idx