diff --git a/gym/wrappers/atari_preprocessing.py b/gym/wrappers/atari_preprocessing.py index 03a33175453..e839b4a09f4 100644 --- a/gym/wrappers/atari_preprocessing.py +++ b/gym/wrappers/atari_preprocessing.py @@ -98,7 +98,6 @@ def __init__( np.empty(env.observation_space.shape, dtype=np.uint8), ] - self.ale = env.unwrapped.ale self.lives = 0 self.game_over = False @@ -111,6 +110,11 @@ def __init__( self.observation_space = Box( low=_low, high=_high, shape=_shape, dtype=_obs_dtype ) + + @property + def ale(self): + """Make ale as a class property to avoid serialization error""" + return self.env.unwrapped.ale def step(self, action): """Applies the preprocessing for an :meth:`env.step`."""