UnicodeDecodeError from tty.readline(), u-Blox 8
    Gary E. Miller 
    gem at rellim.com
       
    Mon May 29 22:38:03 UTC 2023
    
    
  
Yo Hal!
On Mon, 29 May 2023 15:22:43 -0700
Hal Murray via devel <devel at ntpsec.org> wrote:
> Can somebody give me a lesson on this area?
> 
> The code is:
>   tty = open("/dev/ttyACM0")
>   forever:
>     line = tty.readline()
> a) How do I read mostly ASCII without crashing when there is
> non-ASCII?
To open to read binary:
    tty = open("/dev/ttyACM0", "rb")
The line will be binary.  Getting just the NMEA out will be fun.
> b) Why is a u-Blox LEA-M8T sending me non-ASCII crap?
Becasue it wants to.  Becasue UBX is better than NMEA.
>   This is coming from the USB port.  It's running in NMEA mode.
>   I don't think I have sent it any commands.
From u-blox8-M8_ReceiverDescrProtSpec_UBX-13003221.pdf:
"By default all ports are configured for UBX and NMEA protocols."
RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
	gem at rellim.com  Tel:+1 541 382 8588
	    Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 246 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20230529/2626b2bc/attachment.bin>
    
    
More information about the devel
mailing list