title: python 'NoneType' object has no attribute 'from_bytes'
body: <p>Please help, this has been driving me mad.</p>
  
  <pre><code>def get_pinstatus(*args):
      ser.write("p".encode())
      time.sleep(1) # wait for buffer to fill up
  #   for i in range (16):
      value= ser.read(1)
      new_value = int.from_bytes(value, byteorder='big')
  </code></pre>
  
  <p>It's fairly simple code, it's going to read 16 seperate bytes from serial and I need to convert each one to an 8bit int. If I type the last 4 statements into the python command line it works perfectly, just not when in the function.
  No matter how I format the code, I always receive the following error:</p>
  
  <pre><code>new_value = int.from_bytes(value, byteorder='big')
  
  AtrributeError: 'NoneType' object has no attribute 'from_bytes'
  </code></pre>