Skip to content

RuntimeError from ProgressBar #1033

Open
@ivannp

Description

@ivannp

Managed to get a repro to a short script (Python 3.7.5 on Windows):

import prompt_toolkit as pt
import sys
import time

def main():
    with pt.shortcuts.ProgressBar() as pb:
        for i in pb(range(80)):
            time.sleep(0.01)

if __name__ == '__main__':
    main()

No prompt comes back. When I hit any key, I get:

exception calling callback for <Future at 0x1d41f1833c8 state=finished raised RuntimeError>
Traceback (most recent call last):
  File "c:\utils\anaconda3\envs\cync\lib\concurrent\futures\thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "c:\utils\anaconda3\envs\cync\lib\site-packages\prompt_toolkit\input\win32.py", line 522, in wait
    loop.call_soon_threadsafe(ready)
  File "c:\utils\anaconda3\envs\cync\lib\asyncio\base_events.py", line 728, in call_soon_threadsafe
    self._check_closed()
  File "c:\utils\anaconda3\envs\cync\lib\asyncio\base_events.py", line 475, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\utils\anaconda3\envs\cync\lib\concurrent\futures\_base.py", line 324, in _invoke_callbacks
    callback(self)
  File "c:\utils\anaconda3\envs\cync\lib\asyncio\futures.py", line 362, in _call_set_state
    dest_loop.call_soon_threadsafe(_set_state, destination, source)
  File "c:\utils\anaconda3\envs\cync\lib\asyncio\base_events.py", line 728, in call_soon_threadsafe
    self._check_closed()
  File "c:\utils\anaconda3\envs\cync\lib\asyncio\base_events.py", line 475, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions