Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get an 'Unhandled exception in event loop' error on ipython

Tags:

python

I started using ipython recently. Now I often get this message upon doing any action, even simple ones like defining variables:

>>> num = 1

Unhandled exception in event loop:
File "c:\users\USER\appdata\local\programs\python\python38-32\lib\asyncio\proactor_events.py", line 768, in _loop_self_reading
    f.result()  # may raise
File "c:\users\USER\appdata\local\programs\python\python38-32\lib\asyncio\windows_events.py", line 808, in _poll
    value = callback(transferred, key, ov)   
File "c:\users\USER\appdata\local\programs\python\python38-32\lib\asyncio\windows_events.py", line 457, in finish_recv
    raise ConnectionResetError(*exc.args)

Exception [WinError 995] The I/O operation has been aborted because of either a thread exit or an application request
Press ENTER to continue...

This message sometimes shows up, sometimes not, for the same command. Have no idea what I did wrong. The normal interpreter doesn't have this problem. Using 3.8 and installed ipython 7.10.2 through the cmd. Thanks.

like image 457
ziggy Avatar asked Dec 16 '19 11:12

ziggy


1 Answers

I managed to solve the problem. There is some incompatibility between the ipython v7.10.2 and prompt toolkit v3.x. However, everything works fine when downgrading to prompt toolkit v2.x:

python -m pip install -U prompt-toolkit~=2.0

I was advised to do so by the ipython staff at github (so credit to them).

like image 103
ziggy Avatar answered Oct 24 '22 09:10

ziggy