Skip to content

Commit 945ebc7

Browse files
committed
fix some issue with gym_compat module
1 parent e091b31 commit 945ebc7

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,7 @@ getting_started/venv_310_ray/
416416
grid2op/tests/venv_test_autoclass/
417417
test_eduardo.py
418418
grid2op/tests/failed_test*
419+
venv_312
419420

420421
# profiling files
421422
**.prof

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ Next release
7575
(wrong sign for the slack generator)
7676
- [FIXED] the environment would not load in case of an incorrect "layout.json"
7777
instead of raising a warning.
78+
- [FIXED] some issue with gym_compat module for "newest" version of
79+
gymnasium (1.0.0)
7880
- [IMPROVED] error message when forecasts are not correctly set-up
7981

8082
[1.10.3] - 2024-07-12

grid2op/gym_compat/gym_space_converter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,11 @@ def seed(self, seed=None):
266266
of openAI gym
267267
"""
268268
seeds = super(type(self)._DictType, self).seed(seed)
269-
sub_seeds = seeds
269+
if isinstance(seeds, (int, dt_int)):
270+
# newer gymansium version returns int and not a list
271+
sub_seeds = [seeds]
272+
else:
273+
sub_seeds = seeds
270274
max_ = np.iinfo(dt_int).max
271275
for i, space_key in enumerate(sorted(self.spaces.keys())):
272276
sub_seed = sample_seed(max_, self.np_random)

0 commit comments

Comments
 (0)