liormizr / s3path

s3path is a pathlib extension for AWS S3 Service
Apache License 2.0
208 stars 39 forks source link

Hitting 'botocore.exceptions.NoCredentialsError' moving to 0.5.5 from 0.5.0 #169

Closed cooperlees closed 5 months ago

cooperlees commented 5 months ago

Hi,

I maintain bandersnatch, a tool that mirrors PyPI, but I have very little S3 experience as I work @ Meta and we don't use "the cloud". I am sure this is all my misuse / seems a big misuse of `srpath1 APIs, but I'd love to move to 0.5.5 s3path so I can try and move bandersnatch finally to python3.12.

Moving to 0.5.5 on 3.11 I am close to getting our CI passing (as we use minio API to test our s3 usage) but am failing on how to move our scandir forward to 0.5.5 hitting:

botocore.exceptions.NoCredentialsError: Unable to locate credentials

What is this code doing to cause this?

PR moving bandersnatch to 0.5.5: https://github.com/pypa/bandersnatch/pull/1704 Test fail: https://github.com/pypa/bandersnatch/actions/runs/8670833577/job/23779306679?pr=1704 Unit test code: https://github.com/pypa/bandersnatch/blob/latest_s3path/src/bandersnatch/tests/plugins/test_storage_plugin_s3.py#L128

Thanks! Appreciate all the work getting this to support 3.12.

liormizr commented 5 months ago

Hi @cooperlees

I don't see a lot of changes between 0.5 and 0.5.5 in the scandir func.

But I do see something strange in our code First thing accessor is a internal module, it's not explain the error but it prefer to use the S3Path.iterdir method. Also you say that you are running on Python 3.11, accessor works according to Python3.12 and up.

The wird thing here is way scandir raising credentials error but mkdir and all the rest are not. How do you configure the minio service? Also did you change boto3 version?

BTW is you want unit tests and to mock s3 without a real Object Storage system you can use moto. I'm using it in the unit tests and you don't need any addition service for it..

liormizr commented 5 months ago

@cooperlees and update here or can I close this issue?

cooperlees commented 5 months ago

I moved to S3Path.iterdir() - I feel our S3 library need a lot of cleanup to move to all your new APIs.

Thanks!