MartijnBraam / gpsd-py3

Python 3 GPSD client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError when not connected

faerics opened this issue · comments

Consider this script:

#!/usr/bin/env python3
import gpsd
#Get gps position not being connected to the server
packet = gpsd.get_current()

The user then gets an AttributeError not giving the direction where the actual error is.

Well, can a user try to get position not being connected? Definetely, yes, becase GPS often comes as an optional feature, so the system (whatever it is) continues working even if there is no GPS connection.
So I propose to raise something more concrete saying there is no connection, like gpsd.NoConnectionError or gpsd.ConnectionError (second is better since more general)