From f551d1c1b603ec7d4584222da8893c43ef96002a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karahan=20Sar=C4=B1ta=C5=9F?= <44376034+KarahanS@users.noreply.github.com> Date: Mon, 16 Dec 2024 12:31:04 +0300 Subject: [PATCH] Update mujoco_env.py xml file reading --- gymnasium/envs/mujoco/mujoco_env.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gymnasium/envs/mujoco/mujoco_env.py b/gymnasium/envs/mujoco/mujoco_env.py index 4a94bf77e..2cc8971cb 100644 --- a/gymnasium/envs/mujoco/mujoco_env.py +++ b/gymnasium/envs/mujoco/mujoco_env.py @@ -126,7 +126,9 @@ def _initialize_simulation( """ Initialize MuJoCo simulation data structures `mjModel` and `mjData`. """ - model = mujoco.MjModel.from_xml_path(self.fullpath) + with open(self.fullpath, 'r') as f: + xml_content = f.read() + model = mujoco.MjModel.from_xml_string(xml_content) # MjrContext will copy model.vis.global_.off* to con.off* model.vis.global_.offwidth = self.width model.vis.global_.offheight = self.height