MartijnBraam / gpsd-py3

Python 3 GPSD client
107 stars 45 forks source link

Random erreur, KeyError: 'climb' #7

Closed all3kcis closed 7 years ago

all3kcis commented 7 years ago

Randomly I have the following issue : (with climb or lon)

Sats : 8
(47.884275667, 7.227755667)
0
Exception in thread Thread-5:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "*", line 63, in _readData
    data = gpsd.get_current()
  File "/usr/local/lib/python3.4/dist-packages/gpsd/__init__.py", line 267, in get_current
    return GpsResponse.from_json(response)
  File "/usr/local/lib/python3.4/dist-packages/gpsd/__init__.py", line 111, in from_json
    result.climb = last_tpv['climb']
KeyError: 'climb'

With code :

data = gpsd.get_current()
print ('mode : ' + str(data.mode))
if data.mode >= 2:
    print ('Sats : ' + str(data.sats))
    print (data.position())
    print (data.speed())
all3kcis commented 7 years ago

Sorry, it's look good with master version, can you update pip package ?

jkronen commented 7 years ago

I have the same problem. Overwriting the local init.py with the one in the master resolved the problem

MartijnBraam commented 7 years ago

I've pushed 0.3.0 to pypi to solve this now.