Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JupyterLab] TypeError: object _SessionRequestContextManager can't be used in 'await' expression #4065

Closed
lxyscls opened this issue Sep 17, 2019 · 1 comment
Labels
invalid This doesn't seem right wontfix

Comments

@lxyscls
Copy link

lxyscls commented Sep 17, 2019

Long story short

resp = await aiohttp.request('GET', 'http://flupy.org/data/flags/cn/cn.gif')
D:\Continuum\anaconda3\lib\site-packages\ipykernel_launcher.py:4: RuntimeWarning: coroutine 'ClientSession._request' was never awaited
  after removing the cwd from sys.path.
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000000008F0B048>

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-30-35d97f3baca0> in async-def-wrapper()

TypeError: object _SessionRequestContextManager can't be used in 'await' expression

Expected behaviour

Get the URL

Actual behaviour

TypeError

Steps to reproduce

Everytime

Your environment

Anaconda 3, Python 3.7.3 aiohttp 3.6.0

@asvetlov asvetlov added invalid This doesn't seem right wontfix labels Sep 17, 2019
@asvetlov
Copy link
Member

It deliberately can not.
Please use async with aiohttp.request('GET', 'http://flupy.org/data/flags/cn/cn.gif') as resp: ... to explicitly control the response lifecycle.

elops added a commit to elops/zebra_ws_print that referenced this issue May 11, 2022
    Old construct could not be used any more due to lib change.
    aio-libs/aiohttp#4065

    more on change and how to use it properly
    https://docs.aiohttp.org/en/stable/client_quickstart.html#response-content-and-status-code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right wontfix
Projects
None yet
Development

No branches or pull requests

2 participants