title: What is inter_byte_timeout (interCharTimeout) in pyserial?
body: <p>Previously <code>interCharTimeout</code>, since version 3.0 <code>inter_byte_timeout</code>. </p>
  
  <p>API: <a href="http://pyserial.readthedocs.org/en/latest/pyserial_api.html#serial.Serial.inter_byte_timeout" rel="noreferrer">http://pyserial.readthedocs.org/en/latest/pyserial_api.html#serial.Serial.inter_byte_timeout</a> </p>
  
  <p>I suspect that the following is the difference between the regular <code>timeout</code> and <code>inter_byte_timeout</code> is the following: </p>
  
  <ul>
  <li><strong>timeout</strong>: The countdown starts when calling a read function. Even if the bytes keep coming, it will stop reading / throw exception when the specified amount of time has passed from when the read function was called. </li>
  <li><strong>inter_byte_timeout</strong>: Starts the count down clock over, every time a byte is received. If the characters come in continuous stream with fx 1ms between bytes, it can go on forever if the inter_byte_timeout is just greater than 1ms. </li>
  </ul>
  
  <p>Am I right about this? </p>
  
  <p>I suspect not, because I just can't make the function timeout. I have tried with the example below. I was expecting the inter_byte_timeout to make it read and print one "string" at at time, as they are written by the arduino, one per second. Instead it timeouts every three seconds and then prints what came in for that period. </p>
  
  <p><strong>Arduino sketch that writes to serial:</strong></p>
  
  <pre><code>void setup() {
    Serial.begin(9600);
    while(!Serial); //wait for connection
    for (int i=0;true;i++){
      Serial.printf("=== iteration %d ===\n", i);
      delay(1000); //ms
    }
  }
  
  void loop() {
  }
  </code></pre>
  
  <p><strong>Python script:</strong></p>
  
  <pre><code>import serial
  ser=serial.Serial(port='/dev/ttyACM0', timeout=3,inter_byte_timeout=0.01)
  for i in range(100):
      a = ser.read(10000)
      print i, len(a), repr(a)
  </code></pre>
  
  <p><strong>Command line output:</strong></p>
  
  <pre><code>~$ python test.py
  0 60 '=== iteration 0 ===\n=== iteration 1 ===\n=== iteration 2 ===\n'
  1 60 '=== iteration 3 ===\n=== iteration 4 ===\n=== iteration 5 ===\n'
  2 60 '=== iteration 6 ===\n=== iteration 7 ===\n=== iteration 8 ===\n'
  </code></pre>
  
  <p>I am using serial 3.0.1, on Ubuntu. The serial device on the other end is a Teensy (Arduino analog). </p>