John Ralls
2017-07-01 15:14:06 UTC
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,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
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