drivendataorg/cloudpathlib

replace and rename don't handle "directories"

Ouverte

#64 ouverte le 1 sept. 2020

 (0 commentaire) (0 réaction) (0 personne assignée)Python (87 forks)auto 404
S3bugdesign decisiongood first issue

Métriques du dépôt

Stars
 (624 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

CloudPath.replace and CloudPath.rename (which are the same function for cloudpathlib) do not handle "directories".

The pathlib docs say:

Rename this file or directory to the given target, and return a new Path instance pointing to target. If target points to an existing file or directory, it will be unconditionally replaced.
>>> from cloudpathlib import CloudPath
>>> s = CloudPath("s3://my-bucket/")
>>> (s / "foo" / "bar.txt").touch()
>>> (s / "foo").replace(s / "baz")
Traceback (most recent call last):
...
botocore.exceptions.ClientError: An error occurred (404) when calling the HeadObject operation: Not Found

Guide contributeur