Forking a built-in

I am trying to do a minimal tweaks to adapt the GEDCOM built-in importer plug-in to be a testbed addon.

However, the 2 modules that need to be tweaked are the gramps.plugins.lib.libgedcom.py (which parses the various tags) and a module it calls: the gramps.gen.utils.unknown.py (which reports on the tags that were not recognized). The starting point is to tweak the forked unknown.py to write Note objects (or maybe Attributes) that are more post-processing friendly.

I cannot seem to make the forked gramps60.plugins.gedcom_dialect.libs.libgedcom.py import from the forked unknown.py It works when calling the gramps.gen.utils location but not when pointing at utils in the folder 1 level up.

This is the line in the original lib:

GEDCOM dialect experimental repository

In response to a user with a GEDCOM file with Page tags in the source rather than the citation chunk, I am trying to tweak the “unknown/unrecognized” Note written by the GEDCOM importer. The current create_explanation_note Note wraps data with too much noise, complicating parsing in post-process automation.

Example:

Records not imported into SOUR (source) Gramps ID S0003:

Line ignored as not understood                                      Line    51: 2 PAGE inv.nr 5, 31-10-1850, Register van geboortenakten, Burgerlijke Stand Zaandijk, 1843 jan 2 - 1852 dec 29

The fork is of the .ged built-in IMPORT plug-in into an add-on. The key parts to fork seem to be:

And the libgedcom.py imports the unknown.py. That module needs an option that simply passes through the data without changing it. Or has a line pointer to the imported .ged file. Maybe something similar to:

2 PAGE inv.nr 5, 31-10-1850, Register van geboortenakten, Burgerlijke Stand Zaandijk, 1843 jan 2 - 1852 dec 29

import file: Line ignored as not understood    
/home/districtsupport/.gramps/gramps52/plugins/gedcom_dialect/GEDCOM/JohnCardinal_Assess.ged#L51

Target object:
Gramps ID S0003: Records not imported into SOUR (source) 
    

Unfortunately, the different tests for a relative path to import the unknown.py module have not worked. (Perplexity claims a relative path is not supported.) An absolute path the original still works.

The fork looks like:

gramps60/plugins/gedcom_dialect/
├── gedcom_dialect.py
├── gedcom_dialect.gpr.py
├── gedcom_dialect.glade
├── lib/
│   └── libgedcom.py
└── utils/
    └── unknown.py

(In the last few years, @ennoborg had addressed most GEDCOM import support questions, but he has not been active online for a concerningly long period. His typical recommendation was to preprocess .ged files to make them more standard-compliant. As a result, the one-off solution was adopted by only a single user and then largely forgotten. It seems preferable to make a generic solution that also supports diagnostics and post-import processing. And, where reasonable, experiment with improvements that could be added to the built-in.)

Sphinx docs