Creating a citation attribute

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 = ''
attr = Attribute()
attr_type = AttributeType()




Gramps error after previous change is done:

67527153: ERROR: line 157: Unhandled exception
Traceback (most recent call last):
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gui\views\”, line 736, in row_changed
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gui\”, 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\”, line 354, in navigation_label
obj = db.get_citation_from_handle(handle)
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gen\db\”, 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\”, line 1268, in _get_from_handle
return obj_class.create(data)
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gen\lib\”, line 195, in create
return cls().unserialize(data)
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gen\lib\”, line 177, in unserialize
SrcAttributeBase.unserialize(self, srcattr_list)
File “C:\Program Files\GrampsAIO64-5.1.3\gramps\gen\lib\”, 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\”, 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\”, 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.

The only error I see immediately is that you are not using SrcAttribute and SrcAttributeType, which are the correct ones to use in Citations.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.