CSV Import errors

Hi, I have attempted to import a csv file populated from an Excel spreadsheet but get a list of errors (below). I need clarity on what these errors actually mean in order to fix them.

4040107: ERROR: dbloader.py: line 548: Failed to import database.
Traceback (most recent call last):
File “C:\Program Files\GrampsAIO64-5.2.2\gramps\gui\dbloader.py”, line 525, in do_import
self.import_info = importer(
^^^^^^^^^
File “C:\Program Files\GrampsAIO64-5.2.2\gramps\plugins\importer\importcsv.py”, line 155, in importData
msg = parser.parse(filehandle)
^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Program Files\GrampsAIO64-5.2.2\gramps\plugins\importer\importcsv.py”, line 532, in parse
self._parse_csv_data(data, step)
File “C:\Program Files\GrampsAIO64-5.2.2\gramps\plugins\importer\importcsv.py”, line 595, in _parse_csv_data
self._parse_marriage(line_number, row, col)
File “C:\Program Files\GrampsAIO64-5.2.2\gramps\plugins\importer\importcsv.py”, line 681, in _parse_marriage
self.add_note(NoteType.MARRIAGE, marriage, note)
^^^^^^^^^^^^^^^^^
AttributeError: type object ‘NoteType’ has no attribute ‘MARRIAGE’

Lawrence

I have no direct answer. Would you be willing to share the file in a private message?

1 Like

The area of code where the exception is thrown was modified recently in this PR: Update and fix CSV import #1629. It may or may not be the cause of the issue being reported here, but it may help anyone who’s triaging/debugging this.

Worth testing the import in Gramps 5.1.6 to see if the error is present there.

3 Likes

Since the OP is using Windows, the test can be done with 5.1.6 PortableApps Gramps download installed to a USB drive. That bypasses the hassle of uninstalling the 5.2.2 version on their main system.

1 Like

I found it, and there’s no need to provide a CSV file. The code relies on a note type that is not defined in NoteType.py

3 Likes

Thanks for mentioning that PR. The new code introduced a new note type, MARRIAGE, which was not added to the notetype source.

From here, I have no idea whether there is a need to add an extra note type, or that the importer should use the existing FAMILY type instead. Or maybe EVENT, because marriage is an event, and there are no note types that relate to specific event types yet.

I think that it must be EVENT indeed, because the notetype depends on the object that it is attached to.

@dsblank visits the forum occassionally. (About a month ago) So his input his PR would be helpful.

Hi, I found the issue. I’ve built an Excel spreadsheet that can be filled in row after row. and creates a csv in the Gramps format. The transfer was leaving non visible code strings embedded, So have had to clean out before being able to import to Gramps.
Still cleaning up the Excel to automate but looks promising.
Lawrence

2 Likes

You may still run into problems when there is a note attached to a marriage event.

I did a few checks with your files, and they can probably be imported when you leave out the marriage note column. You may also go back to Gramps 5.1.6, which is still available for download here:

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