async with Nursery() as ns:
ns.start_soon(self.pull_sink())
/.../
ns.start_soon(gui(self, self.loop, self.test_queue))
gui is an async function where I create prompt toolkit application.
I call use_asyncio_event_loop with the loop passed from the parent app.
To launch prompt toolkit app I use another nursery context (I will need more concurrent tasks here):
async with Nursery() as ns:
ns.start_soon(application.run_async())
/.../
where application is prompt toolkit app.
In the layout I have TextArea widget, which I initialize with a style for bg and fg colors.
When I create prompt toolkit app as full screen it fails:
Traceback (most recent call last):
File "/usr/lib/python3.6/asyncio/tasks.py", line 537, in _wrap_awaitable
return (yield from awaitable.__await__())
File "/home/wojtek/.local/lib/python3.6/site-packages/prompt_toolkit/eventloop/coroutine.py", line 90, in step_next
new_f = coroutine.throw(exc)
File "/home/wojtek/.local/lib/python3.6/site-packages/prompt_toolkit/application/application.py", line 658, in _run_async2
result = yield f
File "/home/wojtek/.local/lib/python3.6/site-packages/prompt_toolkit/eventloop/coroutine.py", line 86, in step_next
new_f = coroutine.send(None)
File "/home/wojtek/.local/lib/python3.6/site-packages/prompt_toolkit/application/application.py", line 601, in _run_async
self._redraw()
File "/home/wojtek/.local/lib/python3.6/site-packages/prompt_toolkit/application/application.py", line 444, in _redraw
self.renderer.render(self, self.layout)
File "/home/wojtek/.local/lib/python3.6/site-packages/prompt_toolkit/renderer.py", line 595, in render
output.flush()
File "/home/wojtek/.local/lib/python3.6/site-packages/prompt_toolkit/output/vt100.py", line 601, in flush
out.write(data.encode(self.stdout.encoding or 'utf-8', 'replace'))
BlockingIOError: [Errno 11] write could not complete without blocking
Interestingly, when I set full_screen setting to False there is no exception thrown, the style is applied to the widget, and the app is running as expected.
Also, if I do not apply the style to the widget the app runs fine in full screen mode.
Since this is a non-standard usage I tried pulling different string by myself to see if maybe I am doing something wrong that is not mentioned in the docs, but without success.
Do you maybe have a hint whether my approach has a bug somewhere or, less likely, prompt toolkit needs a fix?
Thank you.
EDIT: Another twist - this error appears only when I launch my python program from within midnight commander. It does not appear within xterm.
Seen with:
I have a non-standard architecture, where:
gui
is an async function where I create prompt toolkit application. I calluse_asyncio_event_loop
with theloop
passed from the parent app. To launch prompt toolkit app I use another nursery context (I will need more concurrent tasks here):where
application
is prompt toolkit app. In thelayout
I haveTextArea
widget, which I initialize with a style for bg and fg colors. When I create prompt toolkit app as full screen it fails:Interestingly, when I set
full_screen
setting toFalse
there is no exception thrown, the style is applied to the widget, and the app is running as expected. Also, if I do not apply the style to the widget the app runs fine in full screen mode. Since this is a non-standard usage I tried pulling different string by myself to see if maybe I am doing something wrong that is not mentioned in the docs, but without success. Do you maybe have a hint whether my approach has a bug somewhere or, less likely, prompt toolkit needs a fix? Thank you.EDIT: Another twist - this error appears only when I launch my python program from within midnight commander. It does not appear within xterm.