title: Arduino/Python Serial Communication Write not working
body: <p>I am trying to send messages between python and the arduino via serial port. I am successful going in the Arduino->python direction with this code:</p>
  
  <p>The python:</p>
  
  <pre><code>import termios, fcntl, sys, os, serial, time, smtplib
  ser = serial.Serial('/dev/tty.usbserial-AD02AY8A', 9600, writeTimeout = 0)
  while 1:
      message = ser.readline()
      print(message)
  </code></pre>
  
  <p>The Arduino:</p>
  
  <pre><code>// the setup routine runs once when you press reset:
  void setup() {
  // initialize serial communication at 9600 bits per second:
    Serial.begin(9600);
    Serial.write('1');
  }
  
  // the loop routine runs over and over again forever:
  void loop() {
    // read the input on analog pin 0:
    Serial.println("BOBBY");
    delay(1);        // delay in between reads for stability
  }
  </code></pre>
  
  <p>In this case, I can view the serial port from arduino and the "screen command" on terminal, as well as through the python reprinting "BOBBY". </p>
  
  <p>When I try to send the message from python, it never shows up on the terminal screen or in the Arduino serial port. </p>
  
  <p>Here's the python code that doesn't work. The arduino code shouldn't matter for this one, as I am just monitoring the serial port.  </p>
  
  <pre><code>import termios, fcntl, sys, os, serial, time, smtplib
  ser = serial.Serial('/dev/tty.usbserial-AD02AY8A', 9600, writeTimeout = 0)
  time.sleep(2)
  
  while 1:
    try:
      ser.write('1')
    except: # catch *all* exceptions
      print(e)
  </code></pre>