Can't export GEDCOM, can't import Backup .gpkg into new Tree

Any suggestions for recovering this Tree? “Check and Repair Database…” has not helped.

This problem child was from cleaning up a 1996 sample GEDCOM to make a modern version. (The Places were a complete mess.) Finally got to where yEd could be used to visualize which branches were disconnected. But the GEDCOM export failed:

1262522: ERROR: line 597: Error exporting your Family Tree
Traceback (most recent call last):
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gui\plug\export\", line 593, in save
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\plugins\export\", line 1595, in export_data
    ret = ged_write.write_gedcom_file(filename)
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\plugins\export\", line 248, in write_gedcom_file
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\plugins\export\", line 411, in _individuals
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\plugins\export\", line 457, in _person
    self._photos(person.get_media_list(), 1)
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\plugins\export\", line 708, in _photos
    self._photo(photo, level)
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\plugins\export\", line 1416, in _photo
    photo_obj = self.dbase.get_media_from_handle(photo_obj_id)
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gen\db\", line 1297, in get_media_from_handle
    return self._get_from_handle(MEDIA_KEY, Media, handle)
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gen\db\", line 1265, in _get_from_handle
    raise HandleError('Handle is empty')
gramps.gen.errors.HandleError: Handle is empty
It created a backup without error.

But importing the Backup .gpkg to a blank tree failed:

115198: ERROR: line 569: Failed to import database.
Traceback (most recent call last):
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gui\", line 558, in do_import
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\plugins\importer\", line 96, in impData
    info = importer(database, imp_db_name, user)
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\plugins\importer\", line 149, in importData
    info = parser.parse(xml_file, line_cnt, person_cnt)
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\plugins\importer\", line 966, in parse
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\plugins\importer\", line 3212, in fix_not_instantiated
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gen\utils\", line 92, in make_unknown
    obj = class_func(class_arg)
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\plugins\importer\", line 2220, in start_media
    self.inaugurate(orig_handle, "media", self.object)
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\plugins\importer\", line 753, in inaugurate
  File "C:\Program Files\GrampsAIO64-5.1.5\gramps\gen\lib\", line 183, in unserialize
    date, tag_list, self.private) = data
TypeError: 'NoneType' object is not iterable
Fresh re-install of Gramps AIO64-5.1.5-1 on Windows 10

Can you share the offending files?

Discourse complains:

Sorry, the file you are trying to upload is not authorized (authorized extensions: jpg, jpeg, png, gif, heic, heif, webp).

I’ll eMail it to you. [Also attached to the bug report] (This problem file doesn’t have any information I promised not to share.)

OK, great. I will see it when I see it, and try to get back to you some time this weekend.

1 Like

Handle is empty

You could open the backup file in 7zip then the .gramps file in it in notepad++ and search for the broken handle

1 Like

That’s what I plan to do in Linux, although I’m in Windows right now.

1 Like

I wonder if it might be related to my having deleted the Home Person?

Either way, if a single empty handle causes import & export to abort, that’s wrong.

A bug report (or maybe 1 for import & another for export) can be submitted once the problem is identified and can be repeated from a stepwise description rather than a file.

Did some quick looking (a 3MB text file is a bit much to skim) with Notepad++ but nothing stood out.

Then I Deleted various chunks to find which was choking the parser. It is definitely in the <people><people> chunk.

That’s right, try George Herbert Walker Bush. He has an hlink=“_” in a media reference, in an objref block.

I didn’t find this at first, because I only looked for handle=“” and hlink=“”, but an old fashioned print statement gave me the right clue.

This suggests that we have a piece of code that wrote that “_”, and we need a check for such things on import.

[Bug filed: 0012730: Trees with a NULL handle corruption allow creating (without warning) .gpkg backups that are unloadable - Gramps - Bugtracker – Free Genealogy Software]


The block was for a tagging rectangle in an image Media object. That was from the Photo Tagging gramplet.

      <objref hlink="_">
       <region corner1_x="87" corner1_y="66" corner2_x="99" corner2_y="75"/>

I was expecting the references would go the other direction: from the Media object to the Person rather than linking the media object within the Person.

Hehe, that’s old fashioned relational thinking, isn’t it? :slight_smile:
I think most of our references are two-way, and the region is specific to the person.

After chopping out the bad link, the backup data now exports and exports to GEDCOM for visualizing in yEd. The first graph on the left shows the US President lineage data with a bunch of disconnected clusters. The one on the right shows the same data with all 45 presidents connect by being dropped into a dummy family as children. So that graph confirms there are no extraneous ‘floating’ branches. (Except the 3 people in the upper right: myself & the 2 people involved with compiling the original GEDCOM source.)

I was suspicious because the original GEDCOM of US Presidents included the UK’s Queen Elizabeth II. But she and President George Washington were 2nd cousins, 7 times removed though Augustine Warner 1642-1681 and Mildred Reade 1643-1686.


1 Like

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