Skip to content

TypeError: tuple indices must be integers or slices, not tuple #3

@oatuy

Description

@oatuy

Hello.

Thanks for your codes, but I got some errors.

I’m using your env.py, so I renamed the env folder and changed from env import envs to import env as envs.
Is it correct?

Since I only have CPU, I change self.sess = tf.Session(config=tf.ConfigProto(log_device_placement=True)) to
self.sess = tf.Session()
But maybe this is not related to the errors.

When I ran the codes, I get such errors:

Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydev_run_in_console.py", line 53, in run_file
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File “xx/scalable_maddpg/main.py", line 44, in <module>
    action = maddpg.noise_action(current_state)
  File “xx/scalable_maddpg/maddpg.py", line 158, in noise_action
    action = self.action(state)
  File “xx/scalable_maddpg/maddpg.py", line 138, in action
    action[ii,:] = self.agents[ii].action(state[ii,:])
TypeError: tuple indices must be integers or slices, not tuple

I tried to solve it by changing action[ii,:] = self.agents[ii].action(state[ii,:]) to action[ii,:] = self.agents[ii].action(state[ii]), but it lead to other errors.

Do you have some idea of the errors?
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions