Exception when export data into Gedcom

I receive an exception when exporting data into Gedcom:

2024-03-04 11:13:23.474: ERROR: _exportassistant.py: line 597: Error exporting your Family Tree
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/gramps/gui/plug/export/_exportassistant.py", line 589, in save
    success = export_function(
  File "/usr/lib/python3/dist-packages/gramps/plugins/export/exportgedcom.py", line 1595, in export_data
    ret = ged_write.write_gedcom_file(filename)
  File "/usr/lib/python3/dist-packages/gramps/plugins/export/exportgedcom.py", line 248, in write_gedcom_file
    self._individuals()
  File "/usr/lib/python3/dist-packages/gramps/plugins/export/exportgedcom.py", line 411, in _individuals
    self._person(self.dbase.get_person_from_handle(data[1]))
  File "/usr/lib/python3/dist-packages/gramps/plugins/export/exportgedcom.py", line 454, in _person
    self._assoc(person, 1)
  File "/usr/lib/python3/dist-packages/gramps/plugins/export/exportgedcom.py", line 475, in _assoc
    self._source_references(ref.get_citation_list(), level + 1)
  File "/usr/lib/python3/dist-packages/gramps/plugins/export/exportgedcom.py", line 686, in _source_references
    self._source_ref_record(level, citation_handle)
  File "/usr/lib/python3/dist-packages/gramps/plugins/export/exportgedcom.py", line 1348, in _source_ref_record
    src_handle = citation.get_reference_handle()
AttributeError: 'NoneType' object has no attribute 'get_reference_handle'

Has anybody idea how to fix this?

GRAMPS: 5.1.5
Python: 3.10.12 (main, Nov 20 2023, 15:14:05) [G…
BSDDB: 6.2.9 (5, 3, 28)
sqlite: 3.37.2 (2.6.0)
LANG: en_US.UTF-8
OS: Linux
Distribution: 6.5.0-21-generic

This suggests that you have an empty or invalid citation object.

Did you try Check & Repair?

1 Like

Probably, you are right. But I can not fix them. Some of them are under zip-archive with a password. But looks like I have an idea what to do. Thanks!

1 Like

OK, nice. Please let us know about your fix when it’s ready. I might need it in my own branch too, and maybe we also need this in 5.2.

1 Like

Done, but my solution was not on Gramps side. I unzipped all my archives. Then has written sh script which replaced all the documents to empty with the same names. And then I moved my zip-achives with the original documents to another place. So, now some the most important documents are under password and Gramps works good because the same dummy-files are located where the program expecting. I think, this is the poor sulution. But from now I can use at least the “Check & Repair” feature as all other users.

Anyway, I think Gramps need this fix to ignore errors or at least write more details to terminal (handles, ids,…), because users dont understand what happened - exports just not working. Unfortunatelly I dont know Python.

But no, still the error occurs:

7794681: ERROR: _exportassistant.py: line 597: Error exporting your Family Tree
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/gramps/gui/plug/export/_exportassistant.py”, line 589, in save
success = export_function(
File “/usr/lib/python3/dist-packages/gramps/plugins/export/exportgedcom.py”, line 1595, in export_data
ret = ged_write.write_gedcom_file(filename)
File “/usr/lib/python3/dist-packages/gramps/plugins/export/exportgedcom.py”, line 248, in write_gedcom_file
self._individuals()
File “/usr/lib/python3/dist-packages/gramps/plugins/export/exportgedcom.py”, line 411, in _individuals
self._person(self.dbase.get_person_from_handle(data[1]))
File “/usr/lib/python3/dist-packages/gramps/plugins/export/exportgedcom.py”, line 454, in _person
self._assoc(person, 1)
File “/usr/lib/python3/dist-packages/gramps/plugins/export/exportgedcom.py”, line 475, in _assoc
self._source_references(ref.get_citation_list(), level + 1)
File “/usr/lib/python3/dist-packages/gramps/plugins/export/exportgedcom.py”, line 686, in _source_references
self._source_ref_record(level, citation_handle)
File “/usr/lib/python3/dist-packages/gramps/plugins/export/exportgedcom.py”, line 1348, in _source_ref_record
src_handle = citation.get_reference_handle()
AttributeError: ‘NoneType’ object has no attribute ‘get_reference_handle’

I see that Check & Repair tool shows 3 errors each time when I run it. Looks like it can not fix some issues.

This problem was fixed in 5.1.6, and is listed as the 5th item here:

Can you upgrade to 5.1.6?

Would be nice if you can try Check & Repair again then too, and report back if you still see errors there.

2 Likes

I fixed it, added 2 rows only (1348 and 1349):

1346         citation = self.dbase.get_citation_from_handle(citation_handle)
1347 
1348         if not citation:
1349             return
1350 
1351         src_handle = citation.get_reference_handle()
1352         if src_handle is None:
1353             return
1354 
1355         src = self.dbase.get_source_from_handle(src_handle)
1356         if src is None:
1357             return

The file is located here: /usr/lib/python3/dist-packages/gramps/plugins/export/exportgedcom.py

I will upgrade but a bit later, in 2 months I think, directly to 2.0.*. For now this solution is acceptable for me. Thank you for the help!

1 Like

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