# Buggy code
def __init__(self, method="ascii", **kwargs):
    """Initialize a serial client instance

    The methods to connect are::

      - ascii
      - rtu
      - binary

    :param method: The method to use for connection
    :param port: The serial port to attach to
    :param stopbits: The number of stop bits to use
    :param bytesize: The bytesize of the serial messages
    :param parity: Which kind of parity to use
    :param baudrate: The baud rate to use for the serial device
    :param timeout: The timeout between serial requests (default 3s)
    """
    self.method = method
    self.socket = None
    BaseModbusClient.__init__(self, self.__implementation(method, self), **kwargs)

    self.port = kwargs.get("port", 0)
    self.stopbits = kwargs.get("stopbits", Defaults.Stopbits)
    self.bytesize = kwargs.get("bytesize", Defaults.Bytesize)
    self.parity = kwargs.get("parity", Defaults.Parity)
    self.baudrate = kwargs.get("baudrate", Defaults.Baudrate)
    self.timeout = kwargs.get("timeout", Defaults.Timeout)
    self.last_frame_end = None
    if self.method == "rtu":
        if self.baudrate > 19200:
            self.silent_interval = 1.75 / 1000  # ms
        else:
            self._t0 = float((1 + 8 + 2)) / self.baudrate
            self.inter_char_timeout = 1.5 * self._t0
            self.silent_interval = 3.5 * self._t0
        self.silent_interval = round(self.silent_interval, 6)


# Traceback (AttributeError)
client = ModbusSerialClient(port='notexist', method='rtu')
client.connect()
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "lib/python3.6/site-packages/pymodbus/client/sync.py", line 476, in connect
self.socket.interCharTimeout = self.inter_char_timeout
AttributeError: 'NoneType' object has no attribute 'interCharTimeout'

# Fixed code
def __init__(self, method="ascii", **kwargs):
    """Initialize a serial client instance

    The methods to connect are::

      - ascii
      - rtu
      - binary

    :param method: The method to use for connection
    :param port: The serial port to attach to
    :param stopbits: The number of stop bits to use
    :param bytesize: The bytesize of the serial messages
    :param parity: Which kind of parity to use
    :param baudrate: The baud rate to use for the serial device
    :param timeout: The timeout between serial requests (default 3s)
    :param strict:  Use Inter char timeout for baudrates <= 19200 (adhere
    to modbus standards)
    """
    self.method = method
    self.socket = None
    BaseModbusClient.__init__(self, self.__implementation(method, self), **kwargs)

    self.port = kwargs.get("port", 0)
    self.stopbits = kwargs.get("stopbits", Defaults.Stopbits)
    self.bytesize = kwargs.get("bytesize", Defaults.Bytesize)
    self.parity = kwargs.get("parity", Defaults.Parity)
    self.baudrate = kwargs.get("baudrate", Defaults.Baudrate)
    self.timeout = kwargs.get("timeout", Defaults.Timeout)
    self._strict = kwargs.get("strict", True)
    self.last_frame_end = None
    if self.method == "rtu":
        if self.baudrate > 19200:
            self.silent_interval = 1.75 / 1000  # ms
        else:
            self._t0 = float((1 + 8 + 2)) / self.baudrate
            self.inter_char_timeout = 1.5 * self._t0
            self.silent_interval = 3.5 * self._t0
        self.silent_interval = round(self.silent_interval, 6)