robinostlund / volkswagencarnet-client

A Python client for Volkswagen CarNet
11 stars 3 forks source link

TypeError #4

Open iBamse opened 6 years ago

iBamse commented 6 years ago

Trying to use your package on a Raspberry Pi, but however I try to call the client I am getting the error message below.

Traceback (most recent call last): File "volkswagen-carnet-client/carnet-client.py", line 235, in main() File "volkswagen-carnet-client/carnet-client.py", line 230, in main vw._carnet_run_action() File "volkswagen-carnet-client/carnet-client.py", line 191, in _carnet_run_action self._carnet_do_action() File "volkswagen-carnet-client/carnet-client.py", line 157, in _carnet_do_action self._carnet_print_carnet_info() File "volkswagen-carnet-client/carnet-client.py", line 72, in _carnet_print_carnet_info vehicle_located, vehicle_located_link = self._google_get_location(str(self.vehicle.position['lng']),str(self.vehicle.position['lat'])) File "volkswagen-carnet-client/carnet-client.py", line 207, in _google_get_location data = json.loads(req.content) File "/usr/lib/python3.5/json/init.py", line 312, in loads s.class.name)) TypeError: the JSON object must be str, not 'bytes'

iBamse commented 6 years ago

Fixed it myself by changing row 207 in carnet-client.py from

data = json.loads(req.content)

to

data = json.loads(req.content.decode('utf-8'))

Cheers! /Björn