I want to create a new citation attribute using SuperTool but I missed something. I tried this but it doesn’t work; supertool does what i ask with no errors but when I next try to access the citation Gramps gives me an error
Citation SuperTool code
from gramps.gen.lib import Attribute, AttributeType
url = 'http://test.com/'
attr = Attribute()
attr_type = AttributeType()
attr_type.set('URL')
attr.set_type(attr_type)
attr.set_value(url)
citation.add_attribute(attr)
Gramps error after previous change is done:
67527153: ERROR: grampsapp.py: line 157: Unhandled exception
Traceback (most recent call last):
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gui\views\listview.py”, line 736, in row_changed
self.uistate.modify_statusbar(self.dbstate)
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gui\displaystate.py”, line 636, in modify_statusbar
name, obj = navigation_label(dbstate.db, nav_type, active_handle)
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gen\utils\db.py”, line 354, in navigation_label
obj = db.get_citation_from_handle(handle)
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gen\db\generic.py”, line 1288, in get_citation_from_handle
return self._get_from_handle(CITATION_KEY, Citation, handle)
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gen\db\generic.py”, line 1268, in _get_from_handle
return obj_class.create(data)
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gen\lib\baseobj.py”, line 195, in create
return cls().unserialize(data)
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gen\lib\citation.py”, line 177, in unserialize
SrcAttributeBase.unserialize(self, srcattr_list)
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gen\lib\attrbase.py”, line 72, in unserialize
self.attribute_list = [self._CLASS().unserialize(item) for item in data]
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gen\lib\attrbase.py”, line 72, in
self.attribute_list = [self._CLASS().unserialize(item) for item in data]
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gen\lib\attribute.py”, line 87, in unserialize
(privacy, the_type, self.value) = data
ValueError: too many values to unpack (expected 3)
I suppose I’m not using attribute creation properly but I don’t know where.
Could you help me? Thanks.