title: pyserial- sending in parameters at runtime- input vs. raw_input - security flaw?
body: <p>I am writing a program that opens and records data sent through a serial port into a text file. I am currently adding functionality to allow reconfiguring the serial port during run-time. I prompt the user to choose which variable to change one at a time, so as to keep it simple for myself (i would appreciate elegant solutions as well).</p>
  
  <p>The pyserial function that creates the serial instance (serial.Serial()) has the following parameters:</p>
  
  <pre><code>import serial
  ser = serial.Serial(port=0, baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=None, xonxoff=0, rtscts=0, writeTimeout=None, dsrdtr=None, interCharTimeout=None) #default values shown
  </code></pre>
  
  <p>I notice that while most are int() arguments, some are not, i.e. "timeout". </p>
  
  <p>I know using <code>int(raw_input("for the int() type variables))</code> would let me safely assign the int variables, but the variables with None as default would require an <code>input()</code> function to properly assign the possible None value. </p>
  
  <p>I have read elsewhere that input() is generally not recommended, since it has potential for being exploited(something about eval()?). How then should i handle those inputs? i.e. using serial.Serial() where writeTimout = str(None) throws an error.</p>
  
  <p>Thanks!</p>