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.

ConnectionResetError on Python 3.8 for windows

See original GitHub issue

Using the simplest feature (prompt) fails with async exception.

After running the prompt, I kept pressing a,enter.

I’m using Windows 10, prompt_toolkit.__version__ = '2.0.10'

Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from prompt_toolkit import prompt
>>>
>>> while 1:
...     user_input = prompt('>')
...     print(user_input)
...
>a
a
>a
a
>a
a

Unhandled exception in event loop:
  File "C:\Python38\lib\asyncio\proactor_events.py", line 768, in _loop_self_reading
    f.result()  # may raise
  File "C:\Python38\lib\asyncio\windows_events.py", line 808, in _poll
    value = callback(transferred, key, ov)
  File "C:\Python38\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...
>a
a
>a
a
>a
a
>a
a

Unhandled exception in event loop:
  File "C:\Python38\lib\asyncio\proactor_events.py", line 768, in _loop_self_reading
    f.result()  # may raise
  File "C:\Python38\lib\asyncio\windows_events.py", line 808, in _poll
    value = callback(transferred, key, ov)
  File "C:\Python38\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...
>a
a
>a
a
>                                                                                                                       

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
jonathanslenderscommented, Dec 9, 2019

Issue opened at bugs.python.org: https://bugs.python.org/issue39010

2reactions
jonathanslenderscommented, Feb 9, 2021

This was fixed in Python: https://github.com/python/cpython/pull/22017 Best is to upgrade to a Python version that includes the fix, like Python 3.8.7.

Otherwise, the workaround is to make sure a SelectorEventLoop is used by asyncio. See for instance how it’s done here: https://github.com/xonsh/xonsh/issues/3430

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error in ipython console "Exception [WinError 995] The I/O ...
I have installed python 3.8.5 and in ipython 7.19.0 via Anaconda installer on Windows 10 machine and I get the following error in...
Read more >
wait_closed() can raise ConnectionResetError - Python tracker
open_connection` fails with `ConnectionRefusedError` until I restart the entire Python process. IIUC, just ignoring the exception will not be ...
Read more >
ProactorEventLoop raises unhandled ConnectionResetError
start() loop.run_forever() ``` Leave it running on Windows, in Python 3.8 for a few seconds, then it starts spawning `ConnectionResetError`s.
Read more >
Built-in Exceptions — Python 3.11.1 documentation
In Python, all exceptions must be instances of a class that derives from BaseException. ... the errno attribute is determined from the Windows...
Read more >
http.client — HTTP protocol client — Python 3.11.1 ...
A subclass of ConnectionResetError and BadStatusLine . Raised by HTTPConnection.getresponse() when the attempt to read the response results in no data read ...
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

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