[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Python client - gpsd
From: |
Al Grant |
Subject: |
Python client - gpsd |
Date: |
Thu, 15 Feb 2024 18:40:42 +1300 |
HI,
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'
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'
Any idea what I am doing wrong?
Thanks
Al
- Python client - gpsd,
Al Grant <=