title: How to prevent output from getting cut off in pySerial?
body: <p>I'm noticing that I'm having issues printing out the console output. For example, when I try to execute the help command the output is cut off. If I execute an unrelated command after the help command, the rest of the help page will print out. I'm very new to understanding serial communication and it's probably something to do with buffer or some other obscure thing I don't understand. Any advice on properly printing output from pySerial? </p>
  
  <p>I'm trying to understand how pySerial works. Currently, I'm trying to interact with a synthesizer. Instead of using its built-in console I want to tunnel commands from python onto the serial console and print out the output. </p>
  
  <pre class="lang-py prettyprint-override"><code>
  import serial 
  import time 
  
  
  def send_input(cmd,port):
      '''
      This function sends input to the native serial console. 
      Parameters:
      cmd: a str type, command.
      port: a pyserial pointer. 
  
      Returns:
      None 
      '''
      port.write(cmd.encode() + '\r'.encode())
      time.sleep(1) 
      port.readline()
  
  def recieve_output(port):
      '''
      This reads the output data from the native serial console. 
      Parameters:
      port: a pyserial pointer. 
  
      Returns:
      None 
      '''
      print(port.read(port.inWaiting()).decode().strip('--&gt;'))
  
  def main():
      '''
      pySerial pointer is initialized, 
      continuous user prompt  until exit string 
      is passed in. 
      '''
  
      port = serial.Serial('/dev/cu.usbserial-A5343FPC') #connect to port 
  
      while True:
          usr_input = input('v:&gt; ')
  
          if usr_input.lower() != 'exit':
              send_input(usr_input,port)
              recieve_output(port)
  
          else:
              print('Exiting Program')
              return 
  main()
  
  </code></pre>