Type Error on Neo-6m-GPS.py
TypeError: argument should be integer or bytes-like object, not 'str'
Hi,
You are getting this error message because the parse method from the pynmea2 library expects a string as argument but you are passing bytes.
To solve that issue you need to convert the byte message into string before passing it to the parser as follows:
import serial
import pynmea2
def parseGPS(str_conv):
if str_conv.find('GGA'): #now you can search for string characters
msg = pynmea2.parse(str_conv) #if found use parser
print("Timestamp: %s -- Lat: %s %s -- Lon: %s %s -- Altitude: %s %s" % (msg.timestamp,msg.lat,msg.lat_dir,msg.lon,msg.l$
while True:
serialPort = serial.Serial("/dev/serial0", 9600, timeout=0.5)
str = serialPort.readline()
str_conv = str.decode('utf-8').strip() #convert bytes to string
try:
parseGPS2(str_conv)
except:
continue
Hope it helps!
Regards,
Hi, I forked the project because I wanted to work on the Python part of the repo. In particular, my plan is to remove the dependency to pynmea2. Unfortunately, at the moment I have not too much to work on that but I will definitely fix it on a long run. I will let you guys know when I'm ready for a pull request ;-)
yes please let me know. This repo is just a collection of useful code for the Neo-6m because I didn't find as many useful information.