zenodo / zenodo-rdm

Zenodo, powered by InvenioRDM
https://zenodo.org
GNU General Public License v2.0
50 stars 26 forks source link

fix: csv: change delimiter to comma to pass CSV dialect sniffing #832

Closed ptamarit closed 5 months ago

ptamarit commented 5 months ago

Running invenio-cli services setup --force fails on line 38 (a line with double quotes) in the new CSV dialect sniffing logic added in https://github.com/inveniosoftware/invenio-rdm-records/pull/1721.

Also, going to https://github.com/zenodo/zenodo-rdm/blob/master/app_data/vocabularies/licenses.csv, GitHub shows:

We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 38.

Instead of just fixing the problem on this line, I converted the file to use comma delimiters as done in https://github.com/inveniosoftware/invenio-rdm-records/pull/1721.

I used the following snippet:

import csv

with open(r"licenses.csv") as in_file, open(r"licenses-out.csv", 'w') as out_file:
    semicolonin = csv.reader(in_file, delimiter=';')
    commaout = csv.writer(out_file, delimiter=',')
    for row in semicolonin:
        commaout.writerow(row)

This seems to fix the fixture loading problem and the GitHub preview.

Remark: we are not including the URL changes from https://github.com/inveniosoftware/invenio-rdm-records/pull/1721 in zenodo-rdm.