This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ivankravets
Recipients asvetlov, ivankravets, yselivanov
Date 2021-03-17.12:43:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Hi there,

It seems that "connect_read_pipe" is not implemented in ProactorEventLoop. Does it make sense to update docs in these places?

Or, this is a bug?

# The code to reproduce

import asyncio
import sys

async def read_stdin():
    reader = asyncio.StreamReader()
    protocol = asyncio.StreamReaderProtocol(reader)
    await asyncio.get_running_loop().connect_read_pipe(lambda: protocol, sys.stdin)
    while True:
        line = await reader.readline()
        print("stdin > ", line)

async def main():
    task = asyncio.create_task(read_stdin())
    await asyncio.sleep(5)

if __name__ == "__main__":

P.S: The "loop.add_reader()" raises "NotImplementedError" which is clear according to the docs.

Thanks in advance!

# Log

Exception in callback _ProactorReadPipeTransport._loop_reading()
handle: <Handle _ProactorReadPipeTransport._loop_reading()>
Traceback (most recent call last):
  File "C:\Users\USER\.platformio\python3\lib\asyncio\", line 299, in _loop_reading
    self._read_fut = self._loop._proactor.recv(self._sock, 32768)
  File "C:\Users\USER\.platformio\python3\lib\asyncio\", line 445, in recv
  File "C:\Users\USER\.platformio\python3\lib\asyncio\", line 718, in _register_with_iocp
    _overlapped.CreateIoCompletionPort(obj.fileno(), self._iocp, 0, 0)
OSError: [WinError 6] The handle is invalid

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\USER\.platformio\python3\lib\asyncio\", line 80, in _run, *self._args)
  File "C:\Users\USER\.platformio\python3\lib\asyncio\", line 309, in _loop_reading
    self._fatal_error(exc, 'Fatal read error on pipe transport')
  File "C:\Users\USER\.platformio\python3\lib\asyncio\", line 131, in _fatal_error
  File "C:\Users\USER\.platformio\python3\lib\asyncio\", line 134, in _force_close
    if self._empty_waiter is not None and not self._empty_waiter.done():
AttributeError: '_ProactorReadPipeTransport' object has no attribute '_empty_waiter'
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000002181B927A60>
Traceback (most recent call last):
  File "C:\Users\USER\.platformio\python3\lib\asyncio\", line 116, in __del__
  File "C:\Users\USER\.platformio\python3\lib\asyncio\", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Users\USER\.platformio\python3\lib\asyncio\", line 746, in call_soon
  File "C:\Users\USER\.platformio\python3\lib\asyncio\", line 510, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Date User Action Args
2021-03-17 12:43:44ivankravetssetrecipients: + ivankravets, asvetlov, yselivanov
2021-03-17 12:43:44ivankravetssetmessageid: <>
2021-03-17 12:43:44ivankravetslinkissue43528 messages
2021-03-17 12:43:43ivankravetscreate