Skip to content
New issue

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

nmea crashes when RMC values are blank #94

Open
gigs94 opened this issue Aug 30, 2019 · 1 comment
Open

nmea crashes when RMC values are blank #94

gigs94 opened this issue Aug 30, 2019 · 1 comment

Comments

@gigs94
Copy link

gigs94 commented Aug 30, 2019

If I send a RMC to nmea that has lots of blank values and then I try to get the datatime back, an exception is thrown. The question I have, is should pynmea2 handle this, or is there code that I can call to check if it's valid before I call, p.datetime where p is the RMC instance. Since, datetime is a derived attribute, should it have checks in there to determine if the timestamp in the record is valid or not? and if so, I don't know what to return, None? Or is there a way for a user to check this before calling datetime?

This is what my gps returns when it's doesn't have any signal (like when I'm testing my code in a building)...
'$GPGGA,,,,,,0,00,,,M,0.0,M,,0000*48'

And I get this exception thrown:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/opt/fh/deployed/src/gps_sink.py", line 153, in run
    c(s)
  File "/opt/fh/deployed/src/gps_sink.py", line 50, in set_time
    self.__gps_time = p.datetime
  File "/opt/fh/env/local/lib/python2.7/site-packages/pynmea2/nmea_utils.py", line 98, in datetime
    return datetime.datetime.combine(self.datestamp, self.timestamp)
TypeError: combine() argument 1 must be datetime.date, not None
@xOneca
Copy link
Contributor

xOneca commented Sep 14, 2019

I think this should be managed by pynmea. Returning None, as do datestamp and timestamp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants