-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON loads encoding error #15
Comments
I think this is derivative of a known issue with requests and a multi-year argument over there over whether to default to simplejson or json. Doesn't look like a berzerk issue per se. |
Discussion of addressing it by catching the error and retrying it in this berserk fork: rhgrant10/berserk#17 |
The change merged in that fork fixes my issue. Not sure if creates other problems. |
To recap this "issue". There is a dispute among requests package maintainers. They use simplejson, which is no longer compatible with the python json library (one has the encoding parameter for "loads", one doesn't). requests maintainers appear unwilling to check for compatibility. I have simplejson installed; requests uses that preferentially. The ideal solution would be for simplejson and json to require the same arguments. Probably will happen eventually. In the interim requests should test for the library; they have been asked and appear unwilling to fix it. Thus all upstream users need to test. Options for berserk:
Cheers! |
Thanks for the report, not sure exactly how to fix at the moment but
Is indeed breaking and was quickly reverted afterwards: ZackClements/berserk#5 |
Thanks for the reply. I suggest you simply close the bug; at some point simplejson or requests will surely fix it. Cheers! |
I heard that uninstalling simplejson might be a workaround as a way to avoid this error. |
Hi - I'm getting this error: TypeError: JSONDecoder.init() got an unexpected keyword argument 'encoding'
For instance: A call to "client.users.get_public_data(u'veysey')" has this traceback below.
I think this stems from the change in Python 3.9 in which the keyword encoding was removed from json.loads
Any advice would be appreciated!
File "/home/veysey/.local/lib/python3.10/site-packages/berserk/clients.py", line 229, in get_public_data
return self._r.get(path, converter=models.User.convert)
File "/home/veysey/.local/lib/python3.10/site-packages/berserk/session.py", line 177, in get
return self.request(
File "/home/veysey/.local/lib/python3.10/site-packages/berserk/session.py", line 102, in request
return fmt.handle(response, is_stream=stream, converter=converter)
File "/home/veysey/.local/lib/python3.10/site-packages/berserk/formats.py", line 44, in handle
return converter(self.parse(response))
File "/home/veysey/.local/lib/python3.10/site-packages/berserk/formats.py", line 87, in parse
return response.json(cls=self.decoder)
File "/home/veysey/.local/lib/python3.10/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/home/veysey/.local/lib/python3.10/site-packages/simplejson/init.py", line 533, in loads
return cls(encoding=encoding, **kw).decode(s)
TypeError: JSONDecoder.init() got an unexpected keyword argument 'encoding'
The text was updated successfully, but these errors were encountered: