0

Below is the code I'm trying.

from minio.commonconfig import REPLACE, CopySource

# copy an object `src` from a bucket `darshan` to object `dest_obj`
result = client.copy_object(
    "darshan",
    "dest_obj",
    CopySource("darshan", "src"),
)
print(result.object_name, result.version_id)

Errors:

  1. I have to specify the source object as src/ if I specify src below error:

S3Error: S3 operation failed; code: NoSuchKey, message: Object does not exist, resource: /darshan/src, request_id: 16682AB6445C2722, host_id: None, bucket_name: darshan, object_name: src

  1. Similarly, I have to specify the destination object as dest_obj/ else it creates a file instead of copied folder.
  2. After specifying src & dest object in this manner, it creates an empty directory dest_obj. Not copying any contents from src
Darshan
  • 352
  • 8
  • 24
  • This might be the issue "host_id: None" I don't see you connecting to a client in the code – Darren Mar 12 '21 at 11:25
  • No issues with client creation. As I mention, in points 2, 3 its creating a directory but not what I expected. – Darshan Mar 12 '21 at 12:01
  • I just thought it looked odd and might be worth pointing out. did you look at https://stackoverflow.com/questions/47468148/how-to-copy-s3-object-from-one-bucket-to-another-using-python-boto3 – Darren Mar 12 '21 at 15:03

0 Answers0