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

Warning thrown: Corutine was never waited #1891

Open
j0hn opened this issue Jun 27, 2024 · 3 comments
Open

Warning thrown: Corutine was never waited #1891

j0hn opened this issue Jun 27, 2024 · 3 comments

Comments

@j0hn
Copy link

j0hn commented Jun 27, 2024

Sorry if this is not the place to ask but i'm getting a warning on prompt-toolkit but being thrown using ipdb.

I'm trying to use ipdb inside a flask application and im getting the following warning on every command or after pressing the autocomplete key:

ipdb>                                                                                                                                                                                                                  
/Users/gonzalo/.pyenv/versions/3.10.11/envs/boostup/lib/python3.10/site-packages/prompt_toolkit/application/application.py:1207: RuntimeWarning: coroutine 'Application.run_async.<locals>._run_async.<locals>.auto_flush_input' was never awaited                                                                                  
  await asyncio.wait(                                                                                                                                                                                                   
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
                                                                                                            
ipdb>

I have Python 3.10.11 with prompt_toolkit==3.0.47 installed and ipdb==0.13.13

Any ideas how to get rid of this warning?

@dmedvinsky
Copy link

dmedvinsky commented Aug 19, 2024

I'm facing the same issue with my Django app when running ./manage.py shell with ipython as the REPL. Any time I use autocompletion or even just hit enter with any command, I get a bunch of these RuntimeWarnings.

My env: python==3.12.3, ipython==8.26.0, prompt-toolkit==3.0.47.

When I hit autocomplete, I get

/usr/local/lib/python3.12/asyncio/base_events.py:1972: RuntimeWarning: coroutine 'Buffer._create_completer_coroutine.<locals>.async_completer.<locals>.refresh_while_loading' was never awaited
  handle = self._ready.popleft()

When I hit enter with an empty prompt, I get

/home/djangousr/.local/lib/python3.12/site-packages/prompt_toolkit/application/application.py:1207: RuntimeWarning: coroutine 'Application.run_async.<locals>._run_async.<locals>.auto_flush_input' was never awaited
  await asyncio.wait(
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

/home/djangousr/.local/lib/python3.12/site-packages/prompt_toolkit/key_binding/key_processor.py:414: RuntimeWarning: coroutine 'KeyProcessor._start_timeout.<locals>.wait' was never awaited
  self._flush_wait_task = app.create_background_task(wait())
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

With tracemalloc enabled:

/home/djangousr/.local/lib/python3.12/site-packages/prompt_toolkit/application/application.py:1207: RuntimeWarning: coroutine 'Application.run_async.<locals>._run_async.<locals>.auto_flush_input' was never awaited
  await asyncio.wait(
Object allocated at (most recent call last):
  File "/home/djangousr/.local/lib/python3.12/site-packages/prompt_toolkit/application/application.py", lineno 704
    flush_task = self.create_background_task(auto_flush_input())

/home/djangousr/.local/lib/python3.12/site-packages/prompt_toolkit/key_binding/key_processor.py:414: RuntimeWarning: coroutine 'KeyProcessor._start_timeout.<locals>.wait' was never awaited
  self._flush_wait_task = app.create_background_task(wait())
Object allocated at (most recent call last):
  File "/home/djangousr/.local/lib/python3.12/site-packages/prompt_toolkit/key_binding/key_processor.py", lineno 414
    self._flush_wait_task = app.create_background_task(wait())

/usr/local/lib/python3.12/asyncio/base_events.py:1972: RuntimeWarning: coroutine 'Buffer._create_completer_coroutine.<locals>.async_completer.<locals>.refresh_while_loading' was never awaited
  handle = self._ready.popleft()
Object allocated at (most recent call last):
  File "/home/djangousr/.local/lib/python3.12/site-packages/prompt_toolkit/buffer.py", lineno 1734
    refresh_task = asyncio.ensure_future(refresh_while_loading())

It is very difficult to use shell (especially when debugging something with pdb), so any help would be greatly appreciated.

@tdickman
Copy link

I am facing the same errors as @dmedvinsky.

My env: python==3.12.5, ipython==8.10.0, prompt-toolkit=3.0.47

@swong-wavefin
Copy link

It's not a solution, but you can filter the warning by running filterwarnings in shell_plus

import warnings
warnings.filterwarnings("ignore", category=RuntimeWarning, message="coroutine")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants