title: Serial Receiving from Arduino to Raspberry Pi with PySerial stops after a while
body: <p>I'm working on a project in which I have to receive some 25 character data at a time in order to process it in Raspberry Pi. Here is the example code that generates some data I want to receive from Arduino:</p>
  
  <pre><code>char i =0;
  char  a =0;
  char b=0;
  
  
  void setup(){
  
   Serial.begin(9600);
   for(i=0;i&lt;25;i++){
  
      Serial.print('l');}
      Serial.print('\n');
      delay(2000);
  }
  
  
  void loop(){
  
   for(i=0;i&lt;25;i++){
       for(a=0;a&lt;i;a++){
        if((a==9)||(a==19)||(a==24))
            Serial.print('l');
        else
            Serial.print('d');   
       }
       for(b=0;b&lt;25-i;b++){
            Serial.print('l');
       }
  
  
       delay(2000);
    }
  }
  </code></pre>
  
  <p>It sends a line like this 'llllddddllldddd...' This line is 25 characters length. Now, I want to receive this with Raspberry Pi. Here is the code I'm trying to work:</p>
  
  <pre><code>ser = serial.Serial('/dev/AMA0',9600,timeout=1)
  ser.open()
  
  try:
     serial_data = ser.readline()
     print serial_data
  except serial.serialutil.SerialException:
     pass
  </code></pre>
  
  <p>This code receives data very correctly for like 5 seconds, and then suddenly stops receiving.</p>
  
  <p>Moreover, when I try the following, I get no output, or Input/output errors. </p>
  
  <pre><code>serial_data = ser.readline()
  print serial_data
  </code></pre>
  
  <p><strong>EDIT1:</strong>
  Okay, I commented the exception now. It gives the following error:</p>
  
  <pre><code> raise SerialException('device reporst rediness to read but returned no data (device disconnected?)')
  serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected?)
  </code></pre>
  
  <p>What is the correct way to receive a 25 character data from arduino into raspberry via PySerial? Any help will be greately appreciated.</p>