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

cid-cmd: dictionary changed size during iteration #1124

Open
JoBrad opened this issue Feb 11, 2025 · 0 comments
Open

cid-cmd: dictionary changed size during iteration #1124

JoBrad opened this issue Feb 11, 2025 · 0 comments

Comments

@JoBrad
Copy link

JoBrad commented Feb 11, 2025

I ran the cleanup command with this script, as cloned from the main branch, and ran into the error in my title. It looks like the QuickSight.delete_dataset function pops the dataset from the same dictionary that the Cid class is iterating over. Locally, I changed for dataset in self.qs._datasets.values() to for dataset in list(self.qs._datasets.values()), and this resolved the error.

Traceback (most recent call last):
  File "/Users/xxx/.local/bin/cid-cmd", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/Users/xxx/.local/pipx/venvs/cid-cmd/lib/python3.13/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/xxx/.local/pipx/venvs/cid-cmd/lib/python3.13/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
  File "/Users/xxx/.local/pipx/venvs/cid-cmd/lib/python3.13/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/xxx/.local/pipx/venvs/cid-cmd/lib/python3.13/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/xxx/.local/pipx/venvs/cid-cmd/lib/python3.13/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
  File "/Users/xxx/.local/pipx/venvs/cid-cmd/lib/python3.13/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/xxx/.local/pipx/venvs/cid-cmd/lib/python3.13/site-packages/cid/cli.py", line 44, in wrapper
    res = func(ctx, **kwargs)
  File "/Users/xxx/.local/pipx/venvs/cid-cmd/lib/python3.13/site-packages/cid/cli.py", line 228, in cleanup
    ctx.obj.cleanup(**kwargs)
    ~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/Users/xxx/.local/pipx/venvs/cid-cmd/lib/python3.13/site-packages/cid/common.py", line 190, in wrap
    return func(self, *args, **kwargs)
  File "/Users/xxx/.local/pipx/venvs/cid-cmd/lib/python3.13/site-packages/cid/common.py", line 866, in cleanup
    for dataset in self.qs._datasets.values():
                   ~~~~~~~~~~~~~~~~~~~~~~~~^^
RuntimeError: dictionary changed size during iteration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant