gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Python client - gpsd


From: Gary E. Miller
Subject: Re: Python client - gpsd
Date: Thu, 15 Feb 2024 12:30:23 -0800

Yo Al!

On Thu, 15 Feb 2024 18:40:42 +1300
Al Grant <bigal.nz@gmail.com> wrote:

> So I tried to connect to the gpsd using the python client at :
> https://gpsd.io/gpsd-client-example-code.html
> Unfortunately I get the following error message: TypeError:
> JSONDecoder.__init__() got an unexpected keyword argument 'encoding'

Can you provide the output of gpsdebuginfo?  From here, run as root:

https://gpsd.io/gpsdebuginfo

And tell us what version of gpsd you are running, and where
it came from.

> 
> The full stack trace is :
> 
> ---------------------------------------------------------------------------
> TypeError Traceback (most recent call last)
> Cell In[6], line 6
> 3 session = gps.gps(mode=gps.WATCH_ENABLE)
> 5 try: ---->
> 6 while 0 == session.read():
> 7 if not (gps.MODE_SET & session.valid):
> 8 # not useful, probably not a TPV message
> 9 continue
> File ~/test_fft/venv/lib/python3.11/site-packages/gps/gps.py:285, in
> gps.read(self)
> 283 return status 284 if self.response.startswith("{") and
> self.response.endswith("}\r\n"):
> --> 285 self.unpack(self.response)  
> 286 self.__oldstyle_shim()
> 287 self.valid |= PACKET_SET File
> ~/test_fft/venv/lib/python3.11/site-packages/gps/client.py:199, in
> gpsjson.unpack(self, buf)
> 197 "Unpack a JSON string"
> 198 try:
>  --> 199 self.data = dictwrapper(json.loads(buf.strip(),
> encoding="ascii")) 200 except ValueError as e: 201 raise
> json_error(buf, e.args[0]) File
> /usr/lib/python3.11/json/__init__.py:359, in loads(s, cls,
> object_hook, parse_float, parse_int, parse_constant,
> object_pairs_hook, **kw) 357 if parse_constant is not None: 358
> kw['parse_constant'] = parse_constant --> 359 return
> cls(**kw).decode(s) TypeError: JSONDecoder.__init__() got an
> unexpected keyword argument 'encoding'

Your line numbers look wring.  How did you install the Python gps
module?

BTW, that code runs fine for me.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        gem@rellim.com  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

Attachment: pgpnpke8lP6BO.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]