Please help, this has been driving me mad.

```
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')

```

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:

```
new_value = int.from_bytes(value, byteorder='big')

AtrributeError: 'NoneType' object has no attribute 'from_bytes'

```