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

copydir fails with TypeError: copy() got an unexpected keyword argument 'preserve_time' #90

Open
iljau opened this issue Jun 27, 2022 · 1 comment

Comments

@iljau
Copy link

iljau commented Jun 27, 2022

import fs
import fs_s3fs
from fs import open_fs
from fs_s3fs import S3FS


def copy_to_latest():
    print(f"{fs.__version__=}")
    print(f"{fs_s3fs.__version__=}")

    target_fs: S3FS = open_fs(f's3://my-bucket/some/path/')
    print(f"{target_fs=}")

    src_path = "2022-06-27/08:05:10/"
    print(f"{src_path=}")

    dst_path = "latest"
    print(f"{dst_path=}")

    target_fs.copydir(
        src_path=src_path,
        dst_path=dst_path,
        create=True,
    )


if __name__ == "__main__":
    copy_to_latest()
fs.__version__='2.4.16'
fs_s3fs.__version__='1.1.1'
target_fs=[..]
src_path='2022-06-27/08:05:10/'
dst_path='latest'
Traceback (most recent call last):
  File "/[..]/copydir_bug.py", line 28, in <module>
    copy_to_latest()
  File "/[..]/copydir_bug.py", line 20, in copy_to_latest
    target_fs.copydir(
  File "/opt/venv/lib/python3.8/site-packages/fs/base.py", line 464, in copydir
    copy.copy_dir(self, src_path, self, dst_path, preserve_time=preserve_time)
  File "/opt/venv/lib/python3.8/site-packages/fs/copy.py", line 346, in copy_dir
    copy_dir_if(
  File "/opt/venv/lib/python3.8/site-packages/fs/copy.py", line 450, in copy_dir_if
    copier.copy(_src_fs, dir_path, _dst_fs, copy_path)
  File "/opt/venv/lib/python3.8/site-packages/fs/_bulk.py", line 144, in copy
    copy_file_internal(
  File "/opt/venv/lib/python3.8/site-packages/fs/copy.py", line 263, in copy_file_internal
    src_fs.copy(src_path, dst_path, overwrite=True, preserve_time=preserve_time)
TypeError: copy() got an unexpected keyword argument 'preserve_time'
@i18n-tribe
Copy link

i18n-tribe commented Jan 9, 2024

I've submitted a PR to fix this issue.

Anyone who needs to work around this issue before my PR is merged can install fs-s3fs from my branch.

E.g. if you're using pipenv you can add a line like this in your Pipfile:

fs-s3fs = {git = "https://github.com/i18n-tribe/s3fs.git", ref = "make_copydir_work_again---fixes_issue-90"}

i18n-tribe added a commit to i18n-tribe/s3fs that referenced this issue Jan 9, 2024
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

2 participants