I have this error when I rebuild the site (or live reload too) : Building sites … ERROR Failed to read data from data1.csv/data1.csv: Data not supported for extension 'csv'
The CSV file (/data/data1.csv) is read and processed perfectly, even if message seems to misread the path.
If I juste change some small thing on the CSV file, the error message disappear (no more error) the first time, and still builds perfectly. I change nothing to hugo, templates, or whatever.
The second time I change a small thing on CSV file error messages is back again (and still builds fine)
Now I just change a small thing on a template (for example) and let the CSV untouched. It build without error.
Until I change the CSV, etc… etc …
The code for readng the CSV file is on the previous link and quite simple.
Inside a shortcode, I use passed parameter
{{ if .Get "csvfile" }}
{{ $csvURL := .Get "csvfile" }}
{{ $csv := getCSV "," $csvURL }}
bla bla
{{ end }}
Is it me, a real bug in the build/analysis process or just some strange behaviour on error message ??
Anyway I just ignore this message and all seems fine.
I’m useless @ Golang, but I downloaded the hugo source and looked around to see if I can find some tip about the cause …
The error occurs in site.go,
when function readData() fails and error message doesn’t take CSV files in account (only yaml,json,toml are in the switch case)
when function handleDataFile() can’t readData() and report a wrong file name : r.Path() is wrong
My Golang skills stops me there. May be this can help some Golang guru to find what I think is a (rare) bug, even it doesn’t seems to have a bad effect on the process.
It’s hard for me to say what’s going on here since I don’t follow you completely.
But if an error with reading a CSV file happens every so often, then that might also be caused by Hugo caching the CSV file or performing a fast render.
You can disable both of those options with the --ignoreCache and --disableFastRender command flags for the hugo and hugo server commands. That may help to troubleshoot what causes the error message.
I just add a csv file unknown.csv wich is a copy of a working csv file.
I don’t reference or call or whatever this new file. (verified by searching thru my code)
Hugo sees a change in /data/ & rebuilds the site.
I get this same error, even if I do nothing with the file:
Change detected, rebuilding site
2018-03-02 20:29:19.793 +0100
Data changed "/Users/me/Documents/Git/chart/data/unknown.csv": CREATE
Data changed "/Users/me/Documents/Git/chart/data/stats-contrat-1.1.csv": RENAME
ERROR 2018/03/02 20:29:19 Failed to read data from data1.csv/data1.csv: Data not supported for extension 'csv'
ERROR 2018/03/02 20:29:19 Failed to read data from data2.csv/data2.csv: Data not supported for extension 'csv'
ERROR 2018/03/02 20:29:19 Failed to read data from stats-contrat-1.csv/stats-contrat-1.csv: Data not supported for extension 'csv'
ERROR 2018/03/02 20:29:19 Failed to read data from unknown.csv/unknown.csv: Data not supported for extension 'csv'
Total in 97 ms
INFO 2018/03/02 20:29:21 Received System Events: ["/Users/me/Documents/Git/chart/data/unknown.csv": CHMOD]
The data1.csv / data2.csv / stats-contrat-1.csv are good CSV files and treated well by some other parts of my code.
Seems something is reading/doingwhatever the data folder, and thinking those files are wrong.
Something was changed recently. Because with earlier versions there was no problem witth a CSV file in data. I now have the same problem with a csv-file which rendered until version 0.38. with the cited error message. Now with 0.38 hugo stops rendering after the error.
When I put the csv file in static or content I get the error
error calling getCSV: Cannot find separator ; in CSV.
I only changed the location. No changes in the file or the code that calls the file.