Closed Tears closed 3 years ago
I can't reproduce it with
import asyncio
import aioboto3
import io
async def main():
session = aioboto3.Session()
async with session.resource("s3") as s3:
fileobj = io.BytesIO(b'test')
await s3.upload_fileobj(fileobj, 'aioboto3-test-bucket', 'test1')
asyncio.run(main())
As that returns AttributeError: 's3.ServiceResource' object has no attribute 'upload_fileobj'
If I change it to use session.client
I do indeed get the same error. I will look into this, its entirely possible that if I bump the aiobotocore
version aioboto3
depends on, that would resolve it.
Thank you so much for your fast reply.
The problem comes from running aiohttp==4.0.0a1
which is an alpha package, the latest non-alpha is 3.7.4post0
. Arguably this is an aiobotocore
issue, maybe not yet, but when 4.0.0 lands it'll probably become one. I'll go raise an issue over there, for now, downgrade to aiohttp==3.7.4post0
The problem comes from running
aiohttp==4.0.0a1
which is an alpha package, the latest non-alpha is3.7.4post0
. Arguably this is anaiobotocore
issue, maybe not yet, but when 4.0.0 lands it'll probably become one. I'll go raise an issue over there, for now, downgrade toaiohttp==3.7.4post0
Thank you for your instructions. I have done that, and I'm now receiving the following exception:
response = await s3.upload_fileobj(file, bucket, object_name)
AttributeError: 's3.ServiceResource' object has no attribute 'upload_fileobj'
Would you be so kind to assist me once more? Thanks.
Change async with session.resource("s3") as s3
to async with session.client("s3") as s3
Thank you!
Description
I have the following code:
When executing this function, the following exception is raised:
This is the output of my pip freeze:
Is this a bug in this package or are we doing something wrong? Thanks.