We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In python when I parse the message and I want the longitude, it says attribute error, I use msg.longitude
The text was updated successfully, but these errors were encountered:
That message might not have the longitude attribute. I recommend looping through message fields and finding its attributes using getattr().
getattr()
Example:
msg = pynmea2.parse(sentence) dict = {} for key in msg.fields: dict[key[0]] = getattr(msg, str(key[1]))
In this example key[0] is attribute like "longitude" and key[1] is its parsed value.
key[0]
key[1]
You can check my implementation for complete example:
Sorry, something went wrong.
And this is expected, due to not all the messages carrying this kind of importation. I'd rather check the type of the message first.
No branches or pull requests
In python when I parse the message and I want the longitude, it says attribute error, I use msg.longitude
The text was updated successfully, but these errors were encountered: