Hi, I'm running into issues where the CSV import for decks isn't using the options I ask for.
I'm programmatically creating CSVs so I can memorize poems. Those CSVs look something like this:
Front;Back
# Ode\\nArthur O'Shaughnessy\\n\\n_Beginning_;We are the music makers,
# Ode\\nArthur O'Shaughnessy\\n_Beginning_\\nWe are the music makers,;And we are the dreamers of dreams,
When I try importing with semicolon separator and no quoting, I get the following error: Error: Invalid Record Length: expect 2, got 3 on line 9
Line 9 looks like:
# Ode\\nArthur O'Shaughnessy\\nOn whom the pale moon gleams:\\nYet we are the movers and shakers;Of the world for ever, it seems.
There's only one semicolon separator, so I'm not sure why it's saying there's 3 records.
If I use quoting and the normal comma separator:
"Front","Back"
"# Ode\nArthur O'Shaughnessy\n\n_Beginning_","We are the music makers,"
"# Ode\nArthur O'Shaughnessy\n_Beginning_\nWe are the music makers,","And we are the dreamers of dreams,"
I get this error instead: Error: Invalid Opening Quote: a quote is found inside a field at line 1
So no matter how I format the CSV outputs in my Python script, Mochi refuses to import them.
I've also tried using escaped commas "/,"
and no quotes, but this has the same invalid record length quote.
FIXED
Ahh, I just realised this was an issue with the file encoding.
I've been running using a PowerShell pipeline: Get-Content '.\ode.txt' | python .\poetry.py | Out-File -FilePath "ode.csv"
which, as it turns out, defaults to utf8NoBOM (Encodes in UTF-8 format without Byte Order Mark (BOM)).
When I wrote the file using an ASCII encoding: Get-Content '.\ode.txt' | python .\poetry.py | Out-File -Encoding ascii -FilePath "ode.csv"
, it imported fine.
Thanks Matt! Appreciate the help
The first error seems to be indicating that you have an extra column on line 9. There should be only two columns for each row, (indicating the front and back of the card). What does line 9 look like in that CSV file?
The first example you show looks like you are using semicolons as separators. Did you select the semicolon separator option in the Mochi import window?