#TypeError JsonDecoder

30 messages · Page 1 of 1 (latest)

twin gyro
#

Hi,
I got a little problem. I just started and when I try the command client.account.get the script runs without any output. when i try client.account.get() i get this errors:

Traceback (most recent call last):
File "/home/jugger/Schreibtisch/ai/JuggerBOT/bot.py", line 7, in <module>
client.account.get()
File "/home/jugger/.local/lib/python3.11/site-packages/berserk/clients.py", line 115, in get
return self._r.get(path, converter=models.Account.convert)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jugger/.local/lib/python3.11/site-packages/berserk/session.py", line 60, in get
return self.request('GET', *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jugger/.local/lib/python3.11/site-packages/berserk/session.py", line 56, in request
return fmt.handle(response, is_stream=is_stream, converter=converter)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jugger/.local/lib/python3.11/site-packages/berserk/formats.py", line 35, in handle
return converter(self.parse(response))
^^^^^^^^^^^^^^^^^^^^
File "/home/jugger/.local/lib/python3.11/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 971, in json
return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/simplejson/init.py", line 542, in loads
return cls(encoding=encoding, **kw).decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: JSONDecoder.init() got an unexpected keyword argument 'encoding'

running the command upgrade_to_bot worked when i did it without '()' and also made the account to a bot account.

#

python version 3.11.2

runic adder
#

Oooh, those are some nice help messages from the problem, yeah?
What are your thoughts about the problem?

twin gyro
#

that i got the wrong python version because the jsondecoder got the wrong number of arguments? but I can't find anything about that in the documentation

#

except that python 3.8 and later is supported - 3.11 shouldn't be a problem then or?

runic adder
#

Sounds good to me

runic adder
#

It looks like the line numbers from your stacktrace doesn't match up with the latest source code.
Maybe using a newer version would help? (I have no concrete reason to believe so, just in general it can be good to update versions)
In your stacktrace it mentions line 115 in clients.py,
and that seems to be regarding Simuls if one browse the master branch in the source code of the repository that was recently moved to lichess-org: https://github.com/lichess-org/berserk/blob/master/berserk/clients.py#L115
But maybe the real reasons hide deeper in the stacktrace - in the simplejson module... 🤔

twin gyro
#

i reinstalled berserk-0.10.0 and i still get the same message (with pip install berserk) is there an other way to install berserk?

#

because the newist release is 0.11.0

runic adder
#

Oh! That sounds like a good thing to aim for then!
The readme in the lichess-org berserk repo said to uninstall some downsteram berserk. Maybe that's what you need to do?

twin gyro
#

already done - when i install berserk - uninstall install - (doesnt matter if with pip or pip3) it always installs 0.10.0

runic adder
twin gyro
#

do i have to change the .py files by hand? 😦

runic adder
#

I wouldn't think so.
Maybe you'll need to search for information about pip.
Where it searches for new versions etc.
Maybe you can try to install it in a virtual machine or docker container and see if you get different behaviour, etc etc.

twin gyro
#

i just updated pip - it still installs 0.10 😦

runic adder
twin gyro
#

where is mr meeseeks when you need him *cry

#

i tried now berserk(0.10.0) zack-berserk(0.11.1) and berserk-downstream(0.11.12) - everywhere the same erroroutput

#

except at the zack - berserk i get the error in line 113 and in downstream in line 127

twin gyro
#

i replaced all the python files with the files from github - now this error is thrown: Traceback (most recent call last):
File "/home/jugger/Schreibtisch/ai/JuggerBOT/bot.py", line 7, in <module>
client.account.get()
File "/home/jugger/.local/lib/python3.11/site-packages/berserk/clients.py", line 135, in get
return self._r.get(path, converter=models.Account.convert)

File "/home/jugger/.local/lib/python3.11/site-packages/berserk/session.py", line 175, in get
return self.request(
File "/home/jugger/.local/lib/python3.11/site-packages/berserk/session.py", line 100, in request
return fmt.handle(response, is_stream=stream, converter=converter)

File "/home/jugger/.local/lib/python3.11/site-packages/berserk/formats.py", line 44, in handle
return converter(self.parse(response))
File "/home/jugger/.local/lib/python3.11/site-packages/berserk/formats.py", line 87, in parse
return response.json(cls=self.decoder)
File "/usr/lib/python3/dist-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3/dist-packages/simplejson/init.py", line 542, in loads
return cls(encoding=encoding, **kw).decode(s)

TypeError: JSONDecoder.init() got an unexpected keyword argument 'encoding'

runic adder
#

Maybe the dependencies are old? 🤔

twin gyro
#

how can i check for update?

runic adder
#

pip seems to be some package/module manager for python? Maybe it has help flags?

twin gyro
#

i reinstalled the requirements - didn't help

runic adder
#

Aww, good try though!
Did 0.10.0 and 0.11.1 and 0.11.12 have different requirements, or were they all the same?

twin gyro
#

all the same

#

as far as i have seen

runic adder
#

Maybe it is a common thing people run into? Maybe it doesn't have anything with berserk to do?

twin gyro
twin gyro
#

i'm giving up - I'll try on my windows pc with pycharm when i'm back home