minio / minio-py

MinIO Client SDK for Python
https://docs.min.io/docs/python-client-quickstart-guide.html
Apache License 2.0
839 stars 321 forks source link

Exeption when create bucket with new location #1131

Closed hungnvk54 closed 3 years ago

hungnvk54 commented 3 years ago

Hi all, There is an errors while using the minio python sdk when we create bucket

` self._client = Minio( endpoint=config.endpoint, access_key=config.access_key, secret_key=config.secret_key, secure=config.secure, region='ap-southeast-1' )

self._client.make_bucket("test-bucket", location='ap-southeast-1') `

Exeption: File "/tmp/pycharm_project_ekyc_server/helper/MinIOServer.py", line 30, in create_bucket self._client.make_bucket(bucket_name, location=self._config.region) File "/media/2T_SSD1/hungnv4/02-Enviroment/virenv/lib/python3.6/site-packages/minio/api.py", line 618, in make_bucket body = marshal(element) File "/media/2T_SSD1/hungnv4/02-Enviroment/virenv/lib/python3.6/site-packages/minio/xml.py", line 99, in marshal return getbytes(obj.toxml(None)) AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'toxml'

Are these any mistake here?

harshavardhana commented 3 years ago

` self._client = Minio( endpoint=config.endpoint, access_key=config.access_key, secret_key=config.secret_key, secure=config.secure, region='ap-southeast-1' )

self._client.make_bucket("test-bucket", location='ap-southeast-1') `

Enable self._client.trace_on(os.Stdout) and run the code again

hungnvk54 commented 3 years ago

Here is the log when enable trace_on stdout

`HEAD / HTTP/1.1 Host: rk-ekyc-image.s3.ap-southeast-1.amazonaws.com User-Agent: MinIO (Linux; x86_64) minio-py/7.0.0 X-Amz-Content-Sha256: UNSIGNED-PAYLOAD X-Amz-Date: 20210723T012401Z Authorization: AWS4-HMAC-SHA256 Credential=REDACTED/20210723/ap-southeast-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=REDACTED

HTTP/1.1 404 x-amz-request-id: ZD39JD3M92MMHB6D x-amz-id-2: vgiAXipFDoFpcfVMVJ15pJEEB8Ps6+FEZCXWg+vBN8KNVugl1CVAPu9zSyeJ+AsotxxWDeaf6vk= Content-Type: application/xml Date: Fri, 23 Jul 2021 01:24:01 GMT Server: AmazonS3 ----------END-HTTP---------- ---------START-HTTP--------- HEAD / HTTP/1.1 Host: rk-ekyc-image.s3.ap-southeast-1.amazonaws.com User-Agent: MinIO (Linux; x86_64) minio-py/7.0.0 X-Amz-Content-Sha256: UNSIGNED-PAYLOAD X-Amz-Date: 20210723T012402Z Authorization: AWS4-HMAC-SHA256 Credential=REDACTED/20210723/ap-southeast-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=REDACTED

HTTP/1.1 404 x-amz-request-id: ZD37CG91RBYAFHWJ x-amz-id-2: JCScFmFNnCQ404NGAhUnlNShou6KCkR7RV+hjq2vZ5vAqMaoi0Ibd1XKP3AYWNr9fU8VasNXy3k= Content-Type: application/xml Date: Fri, 23 Jul 2021 01:24:01 GMT Server: AmazonS3 ----------END-HTTP----------

2021-07-23 08:27:17,285 - logger.logger - ERROR - MinIOServer.create_bucket():38 - 'xml.etree.ElementTree.Element' object has no attribute 'toxml' Traceback (most recent call last): File "/tmp/pycharm_project_ekyc_server/helper/MinIOServer.py", line 33, in create_bucket self._client.make_bucket(bucket_name, location=self._config.region) File "/media/2T_SSD1/hungnv4/02-Enviroment/virenv/lib/python3.6/site-packages/minio/api.py", line 618, in make_bucket body = marshal(element) File "/media/2T_SSD1/hungnv4/02-Enviroment/virenv/lib/python3.6/site-packages/minio/xml.py", line 99, in marshal return getbytes(obj.toxml(None)) AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'toxml'`

hungnvk54 commented 3 years ago

An other info: When change both the region when create the MinIO Client and make_bucket to us-east-1 then every thing work fine.

harshavardhana commented 3 years ago

2021-07-23 08:27:17,285 - logger.logger - ERROR - MinIOServer.create_bucket():38 - 'xml.etree.ElementTree.Element' object has no attribute 'toxml' Traceback (most recent call last): File "/tmp/pycharm_project_ekyc_server/helper/MinIOServer.py", line 33, in create_bucket self._client.make_bucket(bucket_name, location=self._config.region) File "/media/2T_SSD1/hungnv4/02-Enviroment/virenv/lib/python3.6/site-packages/minio/api.py", line 618, in make_bucket body = marshal(element) File "/media/2T_SSD1/hungnv4/02-Enviroment/virenv/lib/python3.6/site-packages/minio/xml.py", line 99, in marshal return getbytes(obj.toxml(None)) AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'toxml'`

This bug was fixed in 014651b2

~ git tag --contains 014651b2
7.0.2
7.0.3
7.0.4
7.1.0

Available in following releases, please upgrade.