为什么我的Minio Python无法下载非文本文件类型? 我有一个自主的米尼奥。 问题:无法下载.csv和.jpg文件。能够下载.txt和.md文件。 这很奇怪,我一直在猛击我的头。 我的水桶政策极为

问题描述 投票:0回答:0
没有在我的Minio设置/设置中,我没有文件类型限制。

我可以通过Web门户下载任何文件类型。无法以编程方式下载.csv,.jpg和.tar文件。

i我尝试通过Web门户手动上传文件,然后以编程方式运行该文件,不起作用。仅适用于.md和.txt文件。

我尝试通过编程上传,然后从同一访问密钥下载,无效。仅适用于.md和.txt文件。

我在我的智慧结束时。已经呆了几个小时了,不能再接受了。精疲力尽的所有chatgpt帮助。 Stackoverflow是我的最后一次尝试 - 相信我,我宁愿在其他地方。

代码:

class MinioUploader: def __init__(self): self.minioClient = Minio( endpoint="myminio.website.com", region="us-east-1", access_key="myaccesskeywhichiwillnotputhere", secret_key="mysecretketywhichiwillnotputhere", secure=True ) def download_all_files(self, bucket_name, local_path="./storage/local_storage/"): if self.minioClient is None: logs_sys.error("Minio client is not initialized.") return if not self.minioClient.bucket_exists(bucket_name): logs_sys.error(f"Bucket: {bucket_name} does not exist") return local_path = os.path.join(local_path, bucket_name) if not os.path.exists(local_path): os.makedirs(local_path) print(f"local_path: {local_path}") objects = self.minioClient.list_objects(bucket_name, recursive=True) for obj in objects: try: print(obj.object_name) # Decode any percent-encoded characters in the object name decoded_object_name = unquote(obj.object_name) # Create a safe, absolute file path safe_local_path = os.path.join(local_path, *decoded_object_name.split('/')) # Ensure the directory for the file exists safe_local_path = safe_local_path.replace("\\", "/") os.makedirs(os.path.dirname(safe_local_path), exist_ok=True) # Download the object print(f"Downloading {obj.object_name} to {safe_local_path}") self.minioClient.fget_object(bucket_name=bucket_name, object_name=obj.object_name, file_path=safe_local_path) except Exception as e: logs_sys.error(f"Error: {e}") print(f"Error: {e}")

PRINT:

D:\TRADING_RESTORE_STRATEGIES>python -u "d:\TRADING_RESTORE_STRATEGIES\storage\minio_s3\minio_client.py" local_path: ./storage/local_storage/testdownloadbucket 11.md Downloading 11.md to ./storage/local_storage/testdownloadbucket/11.md 3-7-2024 3-11-49 AM.jpg Downloading 3-7-2024 3-11-49 AM.jpg to ./storage/local_storage/testdownloadbucket/3-7-2024 3-11-49 AM.jpg Error: S3 operation failed; code: AccessDenied, message: Access denied, resource: /testdownloadbucket/3-7-2024%203-11-49%20AM.jpg, request_id: 17BACF23766A4250, host_id: dd9025af9251148b658df7ac2e3e8, bucket_name: testdownloadbucket, object_name: 3- 7-2024 3-11-49 AM.jpg asad.txt Downloading asad.txt to ./storage/local_storage/testdownloadbucket/asad.txt new.csv Downloading new.csv to ./storage/local_storage/testdownloadbucket/new.csv Error: S3 operation failed; code: AccessDenied, message: Access denied, resource: /testdownloadbucket/new.csv, request_id: 17BACF23839DECB7, h ost_id: dd9025af9251148b658df7ac2e3e8, bucket_name: testdownloadbucket, object_name: new.csv something1.csv Downloading something1.csv to ./storage/local_storage/testdownloadbucket/something1.csv Error: S3 operation failed; code: AccessDenied, message: Access denied, resource: /testdownloadbucket/something1.csv, request_id: 17BACF238744 C16C, host_id: dd9025af9251148b658df7ac2e3e8, bucket_name: testdownloadbucket, object_name: something1.csv test.txt Downloading test.txt to ./storage/local_storage/testdownloadbucket/test.txt <minio.api.Minio object at 0x00000248C9B0B130>

如果您在Cloudflare代理后面有Minio服务。您是否试图关闭代理并仅在Cloudflare中留下DNS,以供Minio Console和Minio URL?我只是遇到了同样的问题,这只是关闭Cloudflare的代理人的问题。某些设置可能导致了这个问题,不知道哪一个。很想知道是否有人发现。

python csv amazon-s3 minio
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.