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

pull with Python API: raises error when directory exists during data pull with python api #10579

Closed
sssilvar opened this issue Oct 3, 2024 · 0 comments · Fixed by #10580
Closed
Assignees
Labels
triage Needs to be triaged

Comments

@sssilvar
Copy link
Contributor

sssilvar commented Oct 3, 2024

Bug Report

Description

When attempting to pull data using the DVC python API (v3.55.2), the os.mkdir(d) function at dvc/fs/dvc.py:574 raises an error if the directory already exists. This results in an unnecessary error where the expected behavior would be to overwrite or skip the directory instead of failing.

Reproduce

Steps to reproduce the bug:

  1. Setup a DVC project and configure a remote.
  2. Pull data to a local directory:
    DVCFileSystem.get(f"/{remote}", str(local_path), recursive=True)
  3. Ensure that the local_path already exists.
  4. The error occurs when DVC tries to create an already existing directory.
File ".../python3.10/site-packages/dvc/fs/dvc.py", line 574, in _get
  os.mkdir(d)
FileExistsError: [Errno 17] File exists:

Expected

When pulling data to a directory that already exists, DVC should either overwrite the existing directory or skip the directory creation step without raising an error.

Additional Information:

  • Error occurs at dvc/fs/dvc.py:574 when using os.mkdir(d) to create a directory.
  • The expected behavior is that DVC should handle existing directories more gracefully, without raising an error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Needs to be triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants