Skip to content
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

got an unexpected keyword argument 'encoding' #17

Open
9acca9 opened this issue Oct 28, 2020 · 3 comments · Fixed by ZackClements/berserk#4 · May be fixed by #32
Open

got an unexpected keyword argument 'encoding' #17

9acca9 opened this issue Oct 28, 2020 · 3 comments · Fixed by ZackClements/berserk#4 · May be fixed by #32
Labels
dependencies Pull requests that update a dependency file

Comments

@9acca9
Copy link

9acca9 commented Oct 28, 2020

  • berserk version: 0.10.0
  • Python version: python 3.7.3
  • Operating System:Raspbian

Description

Im using lichs (https://github.com/Cqsi/lichs).
On windows works perfect, also on Archlinux.
On my raspberry pi with raspbian (after put the token from lichess) i get this, what can i do?:

pi@chess:~/.local/bin $ python3 lichs
Traceback (most recent call last):
  File "lichs", line 10, in <module>
    sys.exit(main())
  File "/home/pi/.local/lib/python3.7/site-packages/lichs/__main__.py", line 34, in main
    account_data = client.account.get()
  File "/home/pi/.local/lib/python3.7/site-packages/berserk/clients.py", line 115, in get
    return self._r.get(path, converter=models.Account.convert)
  File "/home/pi/.local/lib/python3.7/site-packages/berserk/session.py", line 60, in get
    return self.request('GET', *args, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/berserk/session.py", line 56, in request
    return fmt.handle(response, is_stream=is_stream, converter=converter)
  File "/home/pi/.local/lib/python3.7/site-packages/berserk/formats.py", line 35, in handle
    return converter(self.parse(response))
  File "/home/pi/.local/lib/python3.7/site-packages/berserk/formats.py", line 76, in parse
    return response.json(cls=self.decoder)
  File "/usr/lib/python3/dist-packages/requests/models.py", line 889, in json
    self.content.decode(encoding), **kwargs
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 535, in loads
    return cls(encoding=encoding, **kw).decode(s)
TypeError: __init__() got an unexpected keyword argument 'encoding'

Thanks!

@EthanLebowitz
Copy link

I get the exact same error, also on raspbian. I get it when running client.users.get_public_data(username)

@rwst
Copy link

rwst commented Dec 12, 2021

The reason is this issue with the request package which they are not fixing:
psf/requests#4842

One solution would be to deinstall simplejson but here for example jupyter and qt depend on it.
Alternatively use Python environments to control what is loaded.
This means, however, you cannot use berserk in a jupyter notebook, for example.

Oh this is on OpenSuSE Leap BTW.

@rwst
Copy link

rwst commented Dec 12, 2021

BTW these errors can be prevented by catching them from the berserk code, see this:
PrefectHQ/prefect#3151
I will submit a patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
4 participants