Input 无法从异步IO中的标准输入读取文件

Input 无法从异步IO中的标准输入读取文件,input,python-3.6,python-asyncio,Input,Python 3.6,Python Asyncio,我已经编写了一个在asyncio上工作的代码。在这段代码中,我必须使用/check.py

我已经编写了一个在asyncio上工作的代码。在这段代码中,我必须使用
/check.py
我能够从终端提供输入。正常情况下,它工作正常。 但它不适用于从标准输入读取文件中的数据

#!/usr/bin/env python3.6

import asyncio
from aioconsole import ainput

async def read_input():
    while True:
        inp = await ainput()
        print('got ' + inp)

if (__name__ == "__main__"):
    asyncio.get_event_loop().run_until_complete(read_input())
通常它的工作原理是

$ ./check.py 
4
got 4
5
got 5
但是,当我直接从文件中读取时,我面对这个日志:

$ ./check.py < test/test_case 
Traceback (most recent call last):
  File "./check.py", line 12, in <module>
    asyncio.get_event_loop().run_until_complete(read_input())
  File "/usr/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
  File "./check.py", line 8, in read_input
    inp = await ainput()
  File "/usr/local/lib/python3.6/dist-packages/aioconsole/stream.py", line 156, in ainput
    reader, writer = yield from get_standard_streams(loop=loop)
  File "/usr/local/lib/python3.6/dist-packages/aioconsole/stream.py", line 144, in get_standard_streams
    cache[key] = yield from connection
  File "/usr/local/lib/python3.6/dist-packages/aioconsole/stream.py", line 132, in create_standard_streams
    reader, writer = yield from future
  File "/usr/local/lib/python3.6/dist-packages/aioconsole/stream.py", line 114, in open_pipe_connection
    yield from loop.connect_read_pipe(lambda: protocol, pipe_in)
  File "/usr/lib/python3.6/asyncio/base_events.py", line 1099, in connect_read_pipe
    transport = self._make_read_pipe_transport(pipe, protocol, waiter)
  File "/usr/lib/python3.6/asyncio/unix_events.py", line 185, in _make_read_pipe_transport
    return _UnixReadPipeTransport(self, pipe, protocol, waiter, extra)
  File "/usr/lib/python3.6/asyncio/unix_events.py", line 353, in __init__
    raise ValueError("Pipe transport is for pipes/sockets only.")
ValueError: Pipe transport is for pipes/sockets only.
$./check.py
无法理解为什么它的行为有所不同? 我想使用协同程序读取一个类似于
/check.py
的文件。

这是一个已在中修复的文件

只需运行以下命令即可获得最新版本:

$ pip3 install -U aioconsole

这看起来很像一个bug:)你能在上报告吗?当然我会发布,谢谢:)现在我无法获得最新版本。我正在使用python3.6和pip3.6。我正在完成“需求已经是最新的:aioconsole in/usr/local/lib/python3.6/dist-packages(0.1.8)”的工作。命令已成功运行:)更改需要一些时间才能生效:)