Discussion:
[Gramps-devel] signed char is greater than maximum
John Ralls
2017-07-01 15:14:06 UTC
Permalink
Dev,
I played a little bit with an addon.
Looking at some built-in python functions or made
some custom cooking, but still not far away from the
primary ideas. So, nothing very dangerous.
"140135: ERROR: tool.py: line 256: Failed to start tool.
File "/usr/lib/python3/dist-packages/gramps/gui/plug/tool.py", line 252,
in gui_tool
callback = callback)
File "/home/zed/.gramps/gramps42/plugins/RelID/Relation_tab.py", line
270, in __init__
line = (iterator, array('b', new_list))
OverflowError: signed char is greater than maximum"
I suppose there is a type or an encoding issue, but the error
sounds rather like a memory limitation or a synchronization/timing
issue.
My current solution is to comment the related line[1]
as it was only a debug test. So, it can be removed too.
I am not able to reproduce it, but as this issue exists,
I suppose that I missed something or did something wrong
during plugin extensions. A loop? An optimization? I have
no idea. Any help or tip might be welcome.
from array import array
# sometimes 'iterator' (generator) is more faster
#handle_list = map(handle, filtered_list)
iterator = (handle for handle in filtered_list)
new_list=[int(kekule), int(Ga), int(Gb), int(mra), int(rank)]
line = (iterator, array('b', new_list))
[1] https://github.com/gramps-project/addons-source/blob/maintenance/gramps42/RelID/Relation_tab.py#L270
Jérôme,

The error that you’re trying to stuff an int into a byte (“char” is the C type name for an 8-bit int). That works as long as the int is between -127 and 128 but will raise that error if it’s larger.

What do you have in mind for “line”? It seems unlikely that smooshing 4 ints into a single byte array is going to be useful.

Regards,
John Ralls
John Ralls
2017-07-02 14:11:50 UTC
Permalink
--------------------------------------------
Objet: Re: [Gramps-devel] signed char is greater than maximum
Date: Dimanche 2 juillet 2017, 10h07
--------------------------------------------
En date de : Sam 1.7.17, John Ralls
Objet: Re: [Gramps-devel] signed char
is greater than maximum
Date: Samedi 1 juillet 2017, 17h14
The
from array import array
# sometimes 'iterator' (generator)
is more
faster
#handle_list = map(handle,
filtered_list)
iterator = (handle
for handle in filtered_list)
new_list=[int(kekule), int(Ga),
int(Gb), int(mra),
int(rank)]
line =
(iterator, array('b', new_list))
[1] https://github.com/gramps-project/addons-source/blob/maintenance/gramps42/RelID/Relation_tab.py#L270
JérÎme,
The error that you’re trying
to stuff an int into a byte
(“char” is the C type name
for an 8-bit int). That works as
long as the int is between
-127 and 128 but will raise that
error if it’s larger.
What do you have in mind for
“line”? It seems unlikely that
smooshing 4 ints into a
single byte array is going to be
useful.
Regards,
John
Ralls
John,
Yes, I got it.
I am now able to reproduce it.
Thanks.
Well, it will raise an error after the 7th generation,
which starts with sosa/kekule number = "128" ... ;-)
Yes, need a proper (right) way than current code for this variable.
Note, the user (see user-mailing list) is now able to run
the tool. I need to also polish some sections or make
some column headers clearer.
Maybe a useful plugin might be rather a view (the current output is close to a view).
I am thinking on new view for current "Relations" category.
There is a small documentation on addon hosting
https://github.com/gramps-project/addons-source/tree/master/RelID
maybe I should add some screenshots too?
I’d think that a paragraph or two explaining what the add-on actually does is needed more than screenshots.

In addition to regular ahnentafel numbering you might consider ancestral line numbering, see https://gramps-project.org/bugs/view.php?id=5468 <https://gramps-project.org/bugs/view.php?id=5468>. Capers told me at the NGS conference this spring that he had let the patent lapse, so there’s no longer any obstacle to using it in Gramps.

Regards,
John Ralls

Continue reading on narkive:
Loading...