ndjson: TypeError: __init__() got an unexpected keyword argument 'encoding'

401 Views Asked by At

When I run the Flask app on my home PC (python 3.10.5), everything works fine. I try to run the same code on pythonanywhere using Python 3.10 and get error:

    Traceback (most recent call last): 
File "/home/speedclub/mysite/speedclub.py", line 90, in task1play sp = client.challenges.create(username = myclient.get_profile()['username'], rated = False, clock_limit = 60, color='black', position='8/8/8/3k4/8/8/1K6/Q7 w - - 0 1', clock_increment=0, variant='standard') 
File "/home/speedclub/.local/lib/python3.10/site-packages/berserk/clients.py", line 709, in create return self._r.post(path, json=payload) File "/home/speedclub/.local/lib/python3.10/site-packages/berserk/session.py", line 262, in post return self.request( 
File "/home/speedclub/.local/lib/python3.10/site-packages/berserk/session.py", line 102, in request return fmt.handle(response, is_stream=stream, converter=converter) File "/home/speedclub/.local/lib/python3.10/site-packages/berserk/formats.py", line 44, in handle return converter(self.parse(response)) File "/home/speedclub/.local/lib/python3.10/site-packages/berserk/formats.py", line 87, in parse return response.json(cls=self.decoder) 
File "/home/speedclub/.local/lib/python3.10/site-packages/requests/models.py", line 971, in json return complexjson.loads(self.text, **kwargs) 
File "/usr/local/lib/python3.10/site-packages/simplejson/__init__.py", line 542, in loads return cls(encoding=encoding, **kw).decode(s) TypeError: JSONDecoder.__init__() got an unexpected keyword argument 'encoding

I have searched, it seems, the entire Internet, but I have not found a solution to the problem. The library versions are the same on both PC and pythonanywhere: ndjson = 0.3.1, berserk = 0.12.4 requests=2.31.0. Here is the part of my code where the error occurs:

sp = client.challenges.create(username = myclient.get_profile()['username'], rated = False, clock_limit = 60, color='black', position='8/8/8/3k4/8/8/1K6/Q7 w - - 0 1', clock_increment=0, variant='standard')
0

There are 0 best solutions below