qtconsole
                                
                                 qtconsole copied to clipboard
                                
                                    qtconsole copied to clipboard
                            
                            
                            
                        Asyncio in qtconsole blocked by user input
When I run an asyncio corutine within the qtconsole (started with jupyter qtconsole) the events are only processed when entering something in the console (e.g. typing return, or some statement).
How can I run my asyncio coroutined in the jupyter environment?
A minimal example:
In [1]: import asyncio
   ...: 
   ...: if 0: 
   ....     # I tested this, but it doesn't make a difference 
   ...:     import nest_asyncio
   ...:     print('run nest_asyncio.apply() ! ')
   ...:     nest_asyncio.apply()
   ...: 
   ...: loop = asyncio.get_event_loop()
   ...: print(f'created loop {loop}')
   ...: 
   ...: async def worker() -> None:
   ...:     ii=0
   ...:     print('start')
   ...:     while True:
   ...:         print(f'loop {ii}')
   ...:         ii=ii+1
   ...:         await asyncio.sleep(.3)
   ...: 
   ...: 
   ...: cr=worker()        
   ...: asyncio.ensure_future(cr)
created loop <_WindowsSelectorEventLoop running=True closed=False debug=False>
Out[1]: <Task pending coro=<worker() running at <ipython-input-1-ca124bc3adf1>:11>>start
loop 0
loop 1
loop 2
loop 3
In [2]: # nothing happens, untill I run something in the command line
loop 4
loop 5
loop 6
loop 7
In [3]: 1+1
loop 8
Out[3]: 2loop 9
loop 10
loop 11