fput_object file_path not found
ntanh11 opened this issue · comments
Hi
I'm currently use minio-py version 7.1.12.
When I'm trying to use fput_object to move object from bucket to another bucket. Some files seems good. But some, throw any exception:
FileNotFoundError: [WinError 3] The system cannot find the path specified:
Did not change much on object_name or file_path. Just change the bucket_name and keep the object_name.
Sample code like this:
if not client.bucket_exists(backup_bucket):
client.make_bucket(backup_bucket)
logger.info("Getting bucket list.........")
buckets = client.list_buckets()
logger.info(f"Bucket list retrieve, total {len(buckets)} bucket.")
bsize = 1024**2
for bucket in buckets:
total_file = 0
total_size = 0
if bucket.name in list_scan:
logger.info(f"Scaning bucket: {bucket.name}.......")
objects = client.list_objects(bucket_name=bucket.name, recursive=True)
for obj in objects:
logger.info(obj.object_name)
logger.info(obj.last_modified)
if obj.last_modified <= currentts:
logger.info("File need to archive...........")
total_file += 1
total_size += obj.size / bsize
try:
client.get_object(bucket_name=obj.bucket_name, object_name=obj.object_name)
**client.fput_object(bucket_name=backup_bucket, object_name=obj.object_name, file_path=obj.object_name)** #This one thow an exception.
client.remove_object(bucket_name=bucket.name, object_name=obj.object_name)
except S3Error as exc:
logger.error(f"Exception occur {exc}.........")
else:
logger.info("New file, skipping.....")
else:
logger.info(f"Bucket {bucket.name} not in scan list, ignore it.......")
continue
Plus: I can't handle the exception so the code will break.
FileNotFoundError: [WinError 3] The system cannot find the path specified:
this means you don't have respective file in your system.