这是indexloc提供的服务,不要输入任何密码
Skip to content

TypeError: set_agent_id() missing 1 required positional argument: 'agent_id' #669

@ZiyiLiubird

Description

@ZiyiLiubird

When I try to reproduce the example in (https://tianshou.readthedocs.io/en/master/tutorials/tictactoe.html), I encounter an type error: TypeError: object of type 'PettingZooEnv' has no len()
The complete error information is as follows:

Traceback (most recent call last):
  File "tic_tac_toe.py", line 244, in <module>
    watch(args, agent)
  File "tic_tac_toe.py", line 236, in watch
    collector = Collector(policy, env, exploration_noise=True)
  File "/home/lzy/miniconda3/envs/ray/lib/python3.8/site-packages/tianshou/data/collector.py", line 70, in __init__
    self.env_num = len(self.env)
TypeError: object of type 'PettingZooEnv' has no len()

Writing "env = DummyVectorEnv([lambda:env])" after "env = get_env()" can fix this error. Maybe the tutorials should be updated?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions