coroutine `AioSession._create_client` was never awaited
See original GitHub issue-
Async AWS SDK for Python version:
- aioboto3==8.0.2
- aiobotocore==1.0.3
- boto3==1.12.32
- botocore==1.15.32
-
Python version: 3.6
-
Operating System: Linux
Description
When upgrading from 7.1.0 to 8.0.2, I started seeing the following error, and the application quits.
Traceback (most recent call last):
File "x.py", line 21, in <module>
loop.run_until_complete(crash())
File "/usr/lib/python3.6/asyncio/base_events.py", line 488, in run_until_complete
return future.result()
File "x.py", line 16, in crash
bucket = await s3.meta.client.head_bucket(Bucket='test_bucket')
AttributeError: 'ResourceCreaterContext' object has no attribute 'meta'
sys:1: RuntimeWarning: coroutine 'AioSession._create_client' was never awaited
Rolling back to v7.1.0 resolves this issue (pip install aioboto3==7.1.0).
I’ve not had a chance to dig into this properly yet.
What I Did
import asyncio
import botocore
import aioboto3
async def crash():
args = {
'config': botocore.config.Config(
signature_version='s3v4',
),
'aws_access_key_id': 'minioadmin',
'aws_secret_access_key': 'minioadmin',
'endpoint_url': 'http://patch.attie.co.uk:9000/',
'region_name': 'local',
}
s3 = aioboto3.resource('s3', **args)
bucket = await s3.meta.client.head_bucket(Bucket='test_bucket')
assert(False)
loop = asyncio.get_event_loop()
loop.run_until_complete(crash())
loop.close()
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Learning asyncio: "coroutine was never awaited" warning ...
My example returns a coroutine was never awaited warning, can you help to understand and find how to solve it?
Read more >Common Mistakes Using Python3 asyncio
1. Introduction · 2. RuntimeWarning: coroutine foo was never awaited · 3. Task was destroyed but it is pending! · 4. Task/Future is...
Read more >aio-libs/aiobotocore
Store the aiobotocore.AioSession at the module level. do a create_client and store the result at the module level; I don't remember if you...
Read more >coroutine was never awaited · Issue #21639
On termination we get sys:1: RuntimeWarning: coroutine 'Lock.acquire' was never awaited error message. Given there is no acquire in our code and ...
Read more >runtimewarning: coroutine 'main' was never awaited
It looks like you are running asynchronous code in a normal function. The error is complaining that the client.send_message(chat, message) code doesn't have...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed example 😄
Brilliant tip - thanks very much for pointing me at
contextlib.AsyncExitStack👍For any others, @terrycain’s example is missing an
awaiton thecontext_stack.aclose()