Skip to content

Fix AttributeError: Replace shutil.copy_tree with shutil.copytree#954

Merged
bruAristimunha merged 5 commits intodevelopfrom
copilot/fix-shutil-copy-function-typo
Jan 29, 2026
Merged

Fix AttributeError: Replace shutil.copy_tree with shutil.copytree#954
bruAristimunha merged 5 commits intodevelopfrom
copilot/fix-shutil-copy-function-typo

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

shutil.copy_tree does not exist in Python's standard library. The correct function is shutil.copytree.

Changes

  • Fixed method call in moabb/datasets/braininvaders.py line 287
# Before
shutil.copy_tree(path_zip.strip(".zip"), directory)

# After
shutil.copytree(path_zip.strip(".zip"), directory)

This would cause an AttributeError at runtime when downloading Brain Invaders 2013a dataset files.

Original prompt

This section details on the original issue you should resolve

<issue_title>Typo in braininvaders.py: Replace shutil.copy_tree with shutil.copytree</issue_title>
<issue_description>Fix typo: Replace shutil.copy_tree with shutil.copytree
(See https://docs.python.org/3/library/shutil.html#shutil.copytree)

shutil.copy_tree(path_zip.strip(".zip"), directory)
</issue_description>

Comments on the Issue (you are @copilot in this section)

@bruAristimunha Many thanks for report!

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: bruAristimunha <42702466+bruAristimunha@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix typo in braininvaders.py for shutil.copytree Fix AttributeError: Replace shutil.copy_tree with shutil.copytree Jan 27, 2026
Copilot AI requested a review from bruAristimunha January 27, 2026 19:30
@bruAristimunha bruAristimunha marked this pull request as ready for review January 28, 2026 18:35
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30aa112fd7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Add dirs_exist_ok=True to shutil.copytree() call to allow copying
into existing directory. This fixes the runtime error when downloading
BrainInvaders2013a sessions where the target directory is already
created by os.makedirs() earlier in the code.
@bruAristimunha bruAristimunha merged commit a22144b into develop Jan 29, 2026
10 of 12 checks passed
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

Successfully merging this pull request may close these issues.

Typo in braininvaders.py: Replace shutil.copy_tree with shutil.copytree

2 participants