NoneType can't be used in 'await' expression - May be harmless
See original GitHub issueRan into the following traceback when using dask-labextension with jupyter-server-proxy. This occurred with Tornado 6, but went away with Tornado 5. Am using JupyterLab 0.35.4, dask-labextension 0.3.1, Bokeh 1.0.4, and jupyter-server-proxy 1.0.0.
LabApp - ERROR - Uncaught exception GET /proxy/9100/status (10.110.73.60)
HTTPServerRequest(protocol='http', host='10.31.241.45:9999', method='GET', uri='/proxy/9100/status', version='HTTP/1.1', remote_ip='10.110.73.60')
Traceback (most recent call last):
File "/home/nfs/jkirkham/miniconda/envs/rapidsdev37/lib/python3.7/site-packages/tornado/web.py", line 1699, in _execute
result = await result
File "/home/nfs/jkirkham/miniconda/envs/rapidsdev37/lib/python3.7/site-packages/jupyter_server_proxy/websocket.py", line 87, in get
return await self.http_get(*args, **kwargs)
File "/home/nfs/jkirkham/miniconda/envs/rapidsdev37/lib/python3.7/site-packages/jupyter_server_proxy/handlers.py", line 247, in http_get
return await self.proxy(port, proxy_path)
TypeError: object NoneType can't be used in 'await' expression
LabApp - ERROR - Uncaught exception GET /proxy/9100/status (10.110.73.60)
HTTPServerRequest(protocol='http', host='10.31.241.45:9999', method='GET', uri='/proxy/9100/status', version='HTTP/1.1', remote_ip='10.110.73.60')
Traceback (most recent call last):
File "/home/nfs/jkirkham/miniconda/envs/rapidsdev37/lib/python3.7/site-packages/tornado/web.py", line 1699, in _execute
result = await result
File "/home/nfs/jkirkham/miniconda/envs/rapidsdev37/lib/python3.7/site-packages/jupyter_server_proxy/websocket.py", line 87, in get
return await self.http_get(*args, **kwargs)
File "/home/nfs/jkirkham/miniconda/envs/rapidsdev37/lib/python3.7/site-packages/jupyter_server_proxy/handlers.py", line 247, in http_get
return await self.proxy(port, proxy_path)
TypeError: object NoneType can't be used in 'await' expression
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (9 by maintainers)
Top Results From Across the Web
TypeError: object NoneType can't be used in 'await' expression
The solution is simple, remove the await in front of the do_something() since it's not async. Share.
Read more >TypeError: Object nontype can't be used in 'await' expression
Functions you're going to use with await have to be "awaitable", which means they can't return None when you call them. Are you...
Read more >coroutine 'clientsession._request' was never awaited - You.com
First urllib is a blocking library, you can't create a task from it, neither can ... TypeError: object NoneType can't be used in...
Read more >Python Asyncio for Beginners - Medium
TypeError : object NoneType can't be used in 'await' expression. Say what? This error seems very strange at first.
Read more >Changelog — Python 3.11.1 documentation
gh-98086: Make sure patch.dict() can be applied on async functions. ... of potential harmless “malloc can't allocate region” messages spewed ...
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 FreeTop 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
Top GitHub Comments
Running
code-server
withtornado==6.0.4
,jupyter-server-proxy==1.5.0
,jupyterlab==2.1.1
, andjupyterlab_server==1.1.1
I periodically encounter the following, which refers to this line ofhandlers.py
:I considered bundling a fix in https://github.com/jupyterhub/jupyter-server-proxy/pull/209 but it was way too complicated already.
I haven’t understood #239 yet but, ignoring testing issues, and if I remember correctly, to solve this issue one simply needs to add checks to all await statements that one isn’t awaiting
None
. My solution was to write a helper function, something along the lines ofand then replace most
await
calls with this. (Disclaimer: I’m writing from memory and that’s not tested.)However, I’m not an
asyncio
expert (yet), and I don’t know if there’s a more elegant way.