Skip to content

put(recursive=True) failes. #358

Closed

Description

@roy-ht

What happened:
Below code causes an error:

Traceback (most recent call last):
  File "temp.py", line 6, in <module>
    fs.put('tempdir', 's3://our_bucket/key/', recursive=True)
  File "/home/jovyan/temp/venv/lib/python3.7/site-packages/fsspec/asyn.py", line 227, in put
    sync(self.loop, self._put, lpaths, rpaths, **kwargs)
  File "/home/jovyan/temp/venv/lib/python3.7/site-packages/fsspec/asyn.py", line 51, in sync
    raise exc.with_traceback(tb)
  File "/home/jovyan/temp/venv/lib/python3.7/site-packages/fsspec/asyn.py", line 35, in f
    result[0] = await future
  File "/home/jovyan/temp/venv/lib/python3.7/site-packages/fsspec/asyn.py", line 214, in _put
    for lpath, rpath in zip(lpaths, rpaths)
  File "/home/jovyan/temp/venv/lib/python3.7/site-packages/s3fs/core.py", line 601, in _put_file
    with open(lpath, 'rb') as f0:
IsADirectoryError: [Errno 21] Is a directory: '/home/jovyan/temp/tempdir'

And sf3s v0.4 does not.

What you expected to happen:

if recursive=True, all directory contents should be copied to remote.

Minimal Complete Verifiable Example:

$ mkdir tempdir
$ touch tempdir/a.txt
import s3fs
fs = s3fs.S3FileSystem()
fs.put('tempdir', 's3://our_bucket/key/', recursive=True)

Anything else we need to know?:

https://github.com/intake/filesystem_spec/blob/66f8bec62c510161b6bd0b93eb0ff143ad34c72f/fsspec/spec.py#L670

put_file treats directory path, but awaitable "_put_file" doesn't.

Environment:

  • Dask version:
  • Python version: 3.7.5
  • Operating System: Linux
  • Install method (conda, pip, source): pip

Activity

  1. martindurant commented on Sep 9, 2020

    @martindurant
    Member

    Would you please like to test again with the latest versions?

  2. roy-ht commented on Sep 10, 2020

    @roy-ht
    Author

    v0.5.1 looks good to me, Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions