title: Python Serial Read Not Working
body: <p>I am attempting to control a projector using RS232 from python. This link has the needed information about the port settings and expected responses.  <a href="http://www.audiogeneral.com/Optoma/w501_rs232.pdf" rel="nofollow">http://www.audiogeneral.com/Optoma/w501_rs232.pdf</a></p>
  
  <p>To summerise it 
  baud = 9600, 
  Data bits = 8, 
  No parity, 
  1 stop bit, 
  no flow control.</p>
  
  <p>when the command "~00124 1\r" is sent the projector should respond okn where n is the power state.</p>
  
  <p>when the command "~0000 1\r" is sent the projector should power on </p>
  
  <p>From Putty I am able to send the power on command and other commands and see that the projector does what it is supposed to. I can also send the read command and get the appropriate okn response back to putty.</p>
  
  <p>From python I can send the power on command and see the projector power on. however when I send the power state command I never see any character come into the read buffer.  </p>
  
  <p>Here is the code for a test script i wrote trying to debug this. </p>
  
  <pre><code>import serial
  ser = serial.Serial("/dev/ttyUSB0")
  
  print ser.baudrate
  print ser.bytesize
  print ser.parity
  print ser.stopbits
  print ser.xonxoff
  print ser.rtscts
  print ser.dsrdtr 
  print ser.name
  
  print "Power State"
  ser.write("~00124 1")
  
  while ser.inWaiting() &gt; 0:
    response = ser.read(3)
    print response
  
  
  output:
  9600
  8
  N
  1
  False
  False
  False
  /dev/ttyUSB0
  True
  Power State
  </code></pre>
  
  <p>I expect an okn after the power state line but it does not show up  </p>