diff --git a/pyproject.toml b/pyproject.toml index 565d725..f8480b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,5 +23,5 @@ format-jinja = "{% if distance == 0 %}{{ base }}{% else %}{{ base }}+{{ distance [tool.poetry.dependencies] python = "^3.8" -PySuperTuxKart2 = ">=0.3.7" +PySuperTuxKart2 = ">=0.3.8" gymnasium = ">0.29.0" diff --git a/src/pystk2_gymnasium/pystk_process.py b/src/pystk2_gymnasium/pystk_process.py index 82fa2f3..16c3980 100644 --- a/src/pystk2_gymnasium/pystk_process.py +++ b/src/pystk2_gymnasium/pystk_process.py @@ -6,6 +6,8 @@ from typing import List, Optional import pystk2 +logger = logging.getLogger("pystk2_gymnasium.mp") + class PySTKRemoteProcess: world: Optional[pystk2.WorldState] = None @@ -61,8 +63,7 @@ def warmup_race(self, config) -> pystk2.Track: # Start race self.race.start() self.world = pystk2.WorldState() - self.track = pystk2.Track() - self.track.update() + track = pystk2.Track() while True: self.race.step() @@ -70,7 +71,8 @@ def warmup_race(self, config) -> pystk2.Track: if self.world.phase == pystk2.WorldState.Phase.GO_PHASE: break - return self.track + track.update() + return track def get_world(self): if self.world is None: diff --git a/tests/test_envs.py b/tests/test_envs.py index c29fab4..e5a5e54 100644 --- a/tests/test_envs.py +++ b/tests/test_envs.py @@ -21,6 +21,7 @@ def test_env(name, use_ai): ix = 0 done = False state, *_ = env.reset() + logging.exception("Running with environment %s", env.unwrapped.current_track) for _ in range(10): ix += 1 @@ -30,9 +31,6 @@ def test_env(name, use_ai): done = truncated or terminated if done: break - except Exception: - logging.exception("with environment %s", env.current_track) - raise finally: if env is not None: env.close()