PySerial does not receive data correctly
<p>I have a little problem receiving data correctly via pySerial: it often does not read the full data or too much of it. Sometimes and sometimes more often, there are additional characters or some characters/parts of the sended data are missing. It seems, PC and the emitter of the data are not synchronised correctly.</p>

<p>In the current example I use a arduino, sending 'Hello World' to the serial port of my PC (os is Ubuntu 14.04), with the following simple code:</p>

<pre><code>void setup(){
  Serial.begin(9600);
  Serial.print("Programme initiated\n");
}
</code></pre>

<p>I use the following python3 code to receive the data:</p>

<pre><code>import serial
import time

arduino = serial.Serial(port, baudrate=9600, timeout=2)
print(arduino.isOpen)
print(arduino)
time.sleep(1)    

while True:
    print(arduino.readline())
</code></pre>

<p>This is pretty much a simple tutorial example, and here is what I receive (apart from the correct stuff):</p>

<pre><code>b'PrProgramme initiated\n'
</code></pre>

<p>or</p>

<pre><code>b'PProgramme initiated\n'
</code></pre>

<p>or</p>

<pre><code>b'ProgProgramme initiated\n'
</code></pre>

<p>or</p>

<pre><code>b'ogramme initiated\n'
</code></pre>

<p>I moved on with more complex problems in my code, but still I didn't solved that problem. When sending a message in a loop from the arduino (the standard hello world code), it often needs time to stabilise (while that, it again does only show the middle fragment of the data) and after that running quite stable, but even then it sometimes breaks down single lines.</p>

<p>I faced the same difficulties when communicating with a multimeter device. There, it often does not read the first characters or mixes up with previous data.</p>

<p>Did anyone faced that problem before? I think it is a question of synchronisation, but I don't know how to solve it. And what puzzles me, is that I really only used tutorial stuff and it doesn't seem to work properly. Or is it a configuration problem of my PC?</p>