Comments (8)
The error happens even if I ensure there are only ASCII characters in the CSV file. So this is not an encoding issue.
$ vim bank/account/preprocess
iconv -f iso-8859-1 -t ASCII//TRANSLIT "$1" > "$2"
from hledger-flow.
I believe this is caused by the use of the semicolon separator (as opposed to comma) in the CSV file, but the error does not give any hint as to what separator is in use, which hinders troubleshooting for first time users.
Beyond that, it's not obvious how to override the hledger import
's --separator
option. And .rules
file do not support specifying this either. A possible workaround is changing all semicolons into commas within the preprocess
script. Not ideal, but feasible.
Relevant issues:
- simonmichael/hledger#176 (need for configurable separator, closed after the addition of
--separator
tohledger import
) - simonmichael/hledger#868 (need for configurable separator support in .rules files, still open)
from hledger-flow.
In the short term I would suggest using your existing preprocess
script to change the separator.
The preprocess
script is intended to manipulate the format of CSV files, I think this is within the scope of that.
In the long term this would be solved in simonmichael/hledger#868 like you said.
Maybe you could give your opinion on the whitespace separator issue under discussion, and by doing so assist in the completion if that issue?
from hledger-flow.
This issue is more about the clarity of the error message. If the clarity of the message is outside of hledger-flow control, then I need to close this issue and take it up to them. Let me know.
from hledger-flow.
@lestephane We can improve our error messages to be as clear as possible as to what is failing and if it is hledger-flow
or an external program that failed.
But there has been a lot of improvements after 0.11.1.2. Can you try it using 0.12?
I've changed the separators in one of the example input files, and this is what the error looks like in 0.12:
$ hledger-flow --version
hledger-flow 0.12.0.0
$ hledger-flow import
Collecting input files...
Found 3 input files in 0.027027743s. Proceeding with import...
hledger: user error (CSVError (ParseErrorBundle {bundleErrors = TrivialError 0 (Just EndOfInput) (fromList []) :| [], bundlePosState = PosState {pstateInput = "", pstateOffset = 0, pstateSourcePos = SourcePos {sourceName = "/home/andreas/Code/Hledger/hledger-flow-example/import/gawie/bogart/cheque/2-preprocessed/2016/123456789_2016-03-30.csv", sourceLine = Pos 1, sourceColumn = Pos 1}, pstateTabWidth = Pos 8, pstateLinePrefix = ""}}))
=== Begin Error: importing 'import/gawie/bogart/cheque/2-preprocessed/2016/123456789_2016-03-30.csv' using rules file 'import/gawie/bogart/cheque/bogart-cheque.rules' ===
External command:
/usr/bin/hledger print --rules-file /home/andreas/Code/Hledger/hledger-flow-example/import/gawie/bogart/cheque/bogart-cheque.rules --file /home/andreas/Code/Hledger/hledger-flow-example/import/gawie/bogart/cheque/2-preprocessed/2016/123456789_2016-03-30.csv --output-file /home/andreas/Code/Hledger/hledger-flow-example/import/gawie/bogart/cheque/3-journal/2016/123456789_2016-03-30.journal
Exit code 1
Error output:
hledger: user error (CSVError (ParseErrorBundle {bundleErrors = TrivialError 0 (Just EndOfInput) (fromList []) :| [], bundlePosState = PosState {pstateInput = "", pstateOffset = 0, pstateSourcePos = SourcePos {sourceName = "/home/andreas/Code/Hledger/hledger-flow-example/import/gawie/bogart/cheque/2-preprocessed/2016/123456789_2016-03-30.csv", sourceLine = Pos 1, sourceColumn = Pos 1}, pstateTabWidth = Pos 8, pstateLinePrefix = ""}}))
=== End Error: importing 'import/gawie/bogart/cheque/2-preprocessed/2016/123456789_2016-03-30.csv' using rules file 'import/gawie/bogart/cheque/bogart-cheque.rules' ===
I'm keen to hear any suggestions you have on making our error messages clearer.
Although I don't think I would like to try and interpret the output of external programs to make their messages clearer, for that I'd prefer to go upstream.
from hledger-flow.
@lestephane Did you have a look at how the errors are displayed in the latest version? If you think they are fine then we can close this issue, otherwise I'd love to hear your thoughts on how we can improve it.
from hledger-flow.
Let me try just now
from hledger-flow.
The clarity of the error message is not something hledger-flow can do much about, but in the latest version it does at least include the command line that caused the error, which is sufficient for my purpose.
I've since moved away from csv rules file, using mostly awk based construct and preprocess scripts to be fully in control, but the improved logging will no doubt help others. Thanks!
from hledger-flow.
Related Issues (20)
- File-specific rules HOT 5
- hledger-flow does not 'see' _manual_ year subdirectory if there is no corresponding 1-in subdirectory HOT 1
- QUESTION: how to break up a transaction/payment? HOT 12
- If I delete a file in a `1-in` directory, re-running `hledger-flow import` does not remove the corresponding files in the `2-preprocessed` and `3-journal` directories HOT 4
- Missing version bound on turtle breaks build HOT 3
- Have a way to use `--cost` option for income-expense reports HOT 1
- Documentation on workflow HOT 8
- `hledger-flow` reports empty for user sub-accounts (due to missing `directives.journal` at lower levels) HOT 3
- (docs) unclear what to do if starting balance is not 0 HOT 6
- Where to put account declarations and prices? HOT 1
- Support for Apple Silicon (aarch64-darwin) HOT 3
- hackage doesn't have the 0.15 release
- Windows: the preprocess and construct scripts are not executed HOT 1
- QUESTION: tags, reports, multiple contributors, virtual accounts, how to do it simply? HOT 2
- when preprocess is called with a $1 that has a .timeclock extension, $2 has a .csv extension HOT 3
- 3-journal/ files not ending in ".journal" extension are added to yearly include files HOT 6
- Make it possible to configure the number of cores being used (the default is to use all cores, which slows down the machine) HOT 18
- hledger-flow does not 'see' hledger despite it being present in the PATH as a symlinked executable HOT 3
- cabal install error: Not in scope: type constructor 'Rel' HOT 2
- Question: where to include "meta" statements (`account...`, `commodity format` & `alias`) & prices? HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hledger-flow.