question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Unhandled exception in event loop' (WinError 995)

See original GitHub issue

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

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 (Like xyz = “hello”). 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.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:55
  • Comments:48 (10 by maintainers)

github_iconTop GitHub Comments

126reactions
MrEightFivecommented, Feb 22, 2020

After some investigation, I think it is a bug in Windows platform implementation of Python’s asyncio:

Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on Windows 10 Version 1809 (OS Build 17763.1039)

  1. Add to file <path_to_python>\Lib\asyncio\proactor_events.py in function BaseProactorEventLoop._loop_self_reading after line 768 the following code:

766....try: 767........if f is not None: 768............f.result() # may raise ...........if self._stopping: ...............raise exceptions.CancelledError("Event loop is stopping") 769........f = self._proactor.recv(self._ssock, 4096)

  1. Test. I have no more errors…

EDIT: you can just use if self._stopping: return instead in this particular code context (should be a bit faster)

EDIT2: Bug on bugs.python.org and description of what is causing this error (found by someone else): https://bugs.python.org/issue39010#msg362076

25reactions
KyryloKaralyuscommented, May 25, 2020

adding code to proactor_events.py (as MrEightFive suggested) didn’t help but pip install --upgrade prompt-toolkit==2.0.10 did . Win10 Python38.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error in ipython console "Exception [WinError 995] The I/O ...
It seems to be a bug in the ipython prompt toolkit (version >= 3). Try doing this for your environment: conda install prompt-toolkit~=2.0....
Read more >
IPython Unhandled exception in event loop on Windows ...
Unhandled exception in event loop : File "c:\users\USER\appdata\local\programs\python\python38-32\lib\asyncio\proactor_events.py", line 768, in ...
Read more >
IPython Unhandled exception in event loop on Windows Platform
IPython Unhandled exception in event loop on Windows Platform ... in finish_recv raise ConnectionResetError(*exc.args) Exception [WinError 995] The I/O ...
Read more >
Exception [WinError 995] 由于线程退出或应用程序请求的解决 ...
Unhandled exception in event loop : File "C:\Users\secsilm\Anaconda3\lib\asyncio\proactor_events.py", line 768, in _loop_self_reading f.result() ...
Read more >
Crazy exceptions in event loop errors! - Python
args) Exception [WinError 995] The I/O operation has been aborted because of either a thread exit or an application request Press ENTER to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found