Closed louis-h-p closed 2 years ago
Hi @louis-h-p I'm not 100% sure what's going here but it seems to be due to a change in the file format and specifically how the '#' is being used for comments.
Using a totally unrelated CSV tool I'm able to reproduce this error, which makes me more confident the issue isn't in our codebase:
curl -s http://download.geonames.org/export/dump/countryInfo.txt | sed '/^#/d' | xsv cat rows
AD AND 020 AN Andorra Andorra la Vella 468 77006 EU .ad EUR Euro 376 AD### ^(?:AD)*(\d{3})$ ca 3041565 ES,FR
CSV error: record 1 (line: 1, byte: 110): found record with 6 fields, but the previous record has 2 fields
That said, we can hopefully work around it, I will open a PR which implements my own handling of CSV comments which seems to work fine, I'm still not completely clear on why mine works and these other ones don't 🤔
The Geonames servers are pretty notorious for changing file formats or hosting broken files for quite some time. Usually they change it back after a while.
But I checked and found the same thing as @missinglink. It looks like the countryInfo.txt
file has a bunch of comments at the start. Pruning those out might help prevent issues like this.
Thanks for the bug report @louis-h-p, this issue seems to be due to the geonames files changing to include a CSV comment header prefixed with #
characters.
Since it's a non-standard format things broke, but we're handling it in our codebase now so please try again.
Thanks @missinglink & @orangejulius . That works now.
I'm trying to install geonames. I've done this dozens of times in the past but I can't get it to download any data now. I've tried using the geonames docker image, an AWS instance and my a local vagrant image.
During the postinstall steps (npm run download_metadata) nothing is downloaded, it throws the error below immediately. Note I can download the entire AU.zip (or others) from geonames without issue.
Another question - Is it possible to use geonames to import from a local file? or do I have to rely on download_metadata etc?