'TelnetReaderUnicode' object has no attribute '_wait_for_data'
gmatesunny opened this issue · comments
Roshan Mehta commented
I tried to run simple telnet server:
import asyncio, telnetlib3
@asyncio.coroutine
def shell(reader, writer):
writer.write('\r\nWould you like to play a game\r\n')
inp = yield from reader.read(1)
if inp:
writer.echo(inp)
writer.write('\r\nThey say the only way to win '
'is to not play at all.\r\n')
yield from writer.drain()
writer.close()
loop = asyncio.get_event_loop()
coro = telnetlib3.create_server(port=6023, shell=shell)
server = loop.run_until_complete(coro)
loop.run_until_complete(server.wait_closed())
Now when I connect using default telnet client on ubuntu. I get the error message:
Task exception was never retrieved
future: <Task finished coro=<shell() done, defined at /home/roshanmk/workspace/tall-tsif-testbed/tall/simulators/camera/pickCamera.py:3> exception=AttributeError("'TelnetReaderUnicode' object has no attribute '_wait_for_data'",)>
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/tasks.py", line 237, in _step
result = next(coro)
File "/home/roshanmk/workspace/tall-tsif-testbed/tall/simulators/camera/pickCamera.py", line 6, in shell
inp = yield from reader.read(1)
File "/usr/local/lib/python3.4/dist-packages/telnetlib3/stream_reader.py", line 183, in read
yield from self._wait_for_data('read')
AttributeError: 'TelnetReaderUnicode' object has no attribute '_wait_for_data'
I am on Python 3.4.2 and telnetlib3-1.0.1
Jeff Quast commented
This tests OK for me, I can only guess that this method, _wait_for_data
was made available in Python 3.4.3, and the version of Python you had at the time of this bug report was 3.4.2 or 3.4.1
python/cpython@c2c12e4#diff-13f9fd3ccf885eae2de41a12562e3449R381