From 6a05e7ab1ab477ea17ccf1a02689955694339465 Mon Sep 17 00:00:00 2001 From: ahalev Date: Wed, 7 Dec 2022 13:09:49 -0800 Subject: [PATCH 1/2] backward compatability for gym --- src/pymgrid/utils/space.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pymgrid/utils/space.py b/src/pymgrid/utils/space.py index 210bd874..c9e2b957 100644 --- a/src/pymgrid/utils/space.py +++ b/src/pymgrid/utils/space.py @@ -11,7 +11,14 @@ def __init__(self, unnormalized_low, unnormalized_high, shape=None, dtype=np.flo dtype=dtype) self._normalized = Box(low=0, high=1, shape=self._unnormalized.shape, dtype=dtype) - super().__init__(self._unnormalized.shape, self._unnormalized.dtype, seed) + try: + super().__init__(shape=self._unnormalized.shape, dtype=self._unnormalized.dtype, seed=seed) + except TypeError: + super().__init__(shape=self._unnormalized.shape, dtype=self._unnormalized.dtype) + import warnings + import gym + warnings.warn(f"gym.Space does not accept argument 'seed' in version {gym.__version__}; this argument will " + f"be ignored. Upgrade your gym version with 'pip install -U gym' to use this functionality.") def contains(self, x): return x in self._unnormalized From 5bab1ece48713ab109d59bc0c4a3efa3dcd77028 Mon Sep 17 00:00:00 2001 From: ahalev Date: Wed, 7 Dec 2022 15:53:18 -0800 Subject: [PATCH 2/2] Empty-Commit