Python: io.TextIOWrapper illegal newline
Question: I'm trying to set the newline character for SiRF binary messages, but the IO
wrapper doesn't seem to accept the newline chars.

Code:

    
    
    import serial
    import io
    
    port = serial.Serial(port='/dev/ttyUSB0', baudrate=4800, timeout=2)
    sio = io.TextIOWrapper(io.BufferedRWPair(port, port), newline='\xb0\xb3')
    

Output:

    
    
    >>> sio = io.TextIOWrapper(io.BufferedRWPair(port, port, 1), newline='\xb3')
    Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
    ValueError: illegal newline value: �
    >>>
    

Note: It does accept '\x0d'


Answer: You can not just use any character as the newline. From the
[`io.TextIOWrapper()`
documentation](http://docs.python.org/3/library/io.html#io.TextIOWrapper):

> _newline_ controls how line endings are handled. It can be `None`, `''`,
> `'\n'`, `'\r'`, and `'\r\n'`.

You'll have to handle those bytes manually instead of a newline, directly.

