Skip to content

RFC2217 and pyserial-asyncio #46

Open
@yozik04

Description

@yozik04

Trying to connect to remote serial port served by ser2net with pyserial-asyncio. Fails due to error:
NotImplementedError: write_timeout is currently not supported

Trace:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../nextion/client.py:53: in connect
    _, self.connection = await serial_asyncio.create_serial_connection(loop, self.make_protocol, url=self.url, baudrate=self.baudrate)
/usr/lib/python3.6/asyncio/coroutines.py:212: in coro
    res = func(*args, **kw)
/usr/local/lib/python3.6/dist-packages/serial_asyncio/__init__.py:412: in create_serial_connection
    transport = SerialTransport(loop, protocol, ser)
/usr/local/lib/python3.6/dist-packages/serial_asyncio/__init__.py:64: in __init__
    self._serial.write_timeout = 0
/usr/lib/python3/dist-packages/serial/serialutil.py:388: in write_timeout
    self._reconfigure_port()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Serial<id=0x7f37b3c5f2e8, open=True>(port='rfc2217://192.168.1.2:1900', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=0, xonxoff=False, rtscts=False, dsrdtr=False)

    def _reconfigure_port(self):
        """Set communication parameters on opened port."""
        if self._socket is None:
            raise SerialException("Can only operate on open ports")
    
        # if self._timeout != 0 and self._interCharTimeout is not None:
            # XXX
    
        if self._write_timeout is not None:
>           raise NotImplementedError('write_timeout is currently not supported')
E           NotImplementedError: write_timeout is currently not supported

/usr/lib/python3/dist-packages/serial/rfc2217.py:506: NotImplementedError

pyserial-asyncio sets write timeout here:

self._serial.write_timeout = 0

Similar issue on pyserial side: pyserial/pyserial#412

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions