Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ZiyiLiubird opened this issue Jun 15, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@ZiyiLiubird
Copy link

ZiyiLiubird commented Jun 15, 2022

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?

@Trinkle23897 Trinkle23897 added the bug Something isn't working label Jun 15, 2022
@Trinkle23897
Copy link
Collaborator

Thanks for reporting this issue! Yes, feel free to open a pull request to update the tutorial.

5cat added a commit to 5cat/tianshou that referenced this issue Sep 25, 2022
Trinkle23897 pushed a commit that referenced this issue Oct 4, 2022
BFAnas pushed a commit to BFAnas/tianshou that referenced this issue May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants