bug-gnubg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cube-info dictionary type error on linux cli using Python 3.9.2


From: Jim Segrave
Subject: Re: Cube-info dictionary type error on linux cli using Python 3.9.2
Date: Sun, 20 Feb 2022 22:38:59 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0

I need to look at this in depth- on my host the default python is 2.75 (even thouogh nowadays I almost always use python3) and it does what it used to.

I really don't remember how the Python integration works, athough I once used it quite heavily to build databases of matches. I'm sure it's solvable


On 20/02/2022 16:20, Rose Menninger wrote:
Hi. Thanks for your reply.
Unfortunately I forgot to mention that cube-info is supposed to be a dictionary 
and type(gnubg.cubeinfo()) also returns class ‘dict’.

So, if I try to convert it using “bytes” function (as you mentioned), i will 
get an error from bytes function like this:
TypeError: encoding without a string argument

I can convert cube-info dict to bytes using 
json.dumps(gnubg.cubeinfo()).encode(‘utf-8’), but calling gnubg methods with 
this variable as input will throw an error indicating that cube-info should be 
a dictionary (Exception: error in SetCubeInfo).

I should mention that gnubg object is defined in gnubgmodule.c file. So all 
these methods and that exception are defined using C in that file.

As far as I can tell, cube-info related methods that are defined in 
“gnubgmodule.c” file take a dictionary as input argument, check them and then 
call some other functions underneath and finally pass them to Python 
interpreter. I think somewhere in those function calls, they should make this 
str to byte conversion.

If that’s the case, it would be probably beyond my coding abilities to solve 
it. But I’m afraid that maybe that’s not the case and I’m just missing on 
something simple. If anybody can try to reproduce this error, that would help a 
lot.

Any help is greatly appreciated.
Thanks





reply via email to

[Prev in Thread] Current Thread [Next in Thread]