Skip to content

Commit 6e39ea9

Browse files
committed
2 parents fe23a08 + ec0185d commit 6e39ea9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

sumo_rl/environment/env.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@
1818
import traci
1919
from gymnasium.utils import EzPickle, seeding
2020
from pettingzoo import AECEnv
21-
from pettingzoo.utils import agent_selector, wrappers
21+
from pettingzoo.utils import wrappers
22+
23+
24+
try:
25+
# pettingzoo 1.25+
26+
from pettingzoo.utils import AgentSelector
27+
except ImportError:
28+
# pettingzoo 1.24 or earlier
29+
from pettingzoo.utils import agent_selector as AgentSelector
30+
2231
from pettingzoo.utils.conversions import parallel_wrapper_fn
2332

2433
from .observations import DefaultObservationFunction, ObservationFunction
@@ -521,7 +530,7 @@ def __init__(self, **kwargs):
521530

522531
self.agents = self.env.ts_ids
523532
self.possible_agents = self.env.ts_ids
524-
self._agent_selector = agent_selector(self.agents)
533+
self._agent_selector = AgentSelector(self.agents)
525534
self.agent_selection = self._agent_selector.reset()
526535
# spaces
527536
self.action_spaces = {a: self.env.action_spaces(a) for a in self.agents}

0 commit comments

Comments
 (0)