prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Progress bar with asyncio loop?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
Is it supposed do work together? I am getting:
Traceback (most recent call last): | 1/1600 [00:00<00:07, 203.38it/s]
File "/opt/python/3.7.3/lib/python3.7/site-packages/prompt_toolkit/shortcuts/progress_bar/base.py", line 157, in run
self.app.run()
File "/opt/python/3.7.3/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 709, in run
return run()
File "/opt/python/3.7.3/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 682, in run
run_until_complete(f, inputhook=inputhook)
File "/opt/python/3.7.3/lib/python3.7/site-packages/prompt_toolkit/eventloop/defaults.py", line 123, in run_until_complete
return get_event_loop().run_until_complete(future, inputhook=inputhook)
File "/opt/python/3.7.3/lib/python3.7/site-packages/prompt_toolkit/eventloop/asyncio_posix.py", line 36, in run_until_complete
return self.loop.run_until_complete(future)
File "/opt/python/3.7.3/lib/python3.7/site-packages/nest_asyncio.py", line 56, in run_until_complete
f = asyncio.ensure_future(future)
File "/opt/python/3.7.3/lib/python3.7/asyncio/tasks.py", line 590, in ensure_future
return ensure_future(_wrap_awaitable(coro_or_future), loop=loop)
File "/opt/python/3.7.3/lib/python3.7/asyncio/tasks.py", line 580, in ensure_future
loop = events.get_event_loop()
File "/opt/python/3.7.3/lib/python3.7/asyncio/events.py", line 644, in get_event_loop
% threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'Thread-20'.
There is no current event loop in thread 'Thread-20'.
However, my use case is rather unconventional since I have multiple event-loops coexisting: Tk, Qt5 and nested asyncio loops. Before investigating further, I would like to know if the current implementation of the progress bar is expected to work when the prompt_toolkit app uses only the asyncio event loop.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with prompt_toolkit/shortcuts/progress_bar/base.py at ProgressBar.run, then follow the asyncio path through application.py and eventloop/defaults.py shown in the traceback. Determine whether the progress bar supports an asyncio-only app in a thread alongside the reported nested event loops; the issue is complete only when that behavior and any required compatibility change are clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100