Closed dudelson closed 7 years ago
That's hard to detect. YAML parsing isn't strict. If some field is present, which isn't required by the corresponding Go struct, that's just ignored. So, there's no way to detect the absence of an account from an erroneous config file. However, to make things a bit clearer, I have updated the message, highlighted it with red background, and specified which account it can't find.
When parsing the CSV, it's not known which column corresponds to the date. The program tries to parse every column as a date, and if it's successful that column gets picked up. And if no date has been picked up by the time all the columns are parsed, then it throws an error. Without knowing in advance which column corresponds to the date, it's hard to specifically throw an error about invalid date format.
To make things clear, I've added a section in README about common date formats used. So, users can just copy paste the relevant format, without needed to understand Go.
-a
flag. This makes sense, because the CSV files are downloaded from bank accounts or credit card statements, and then input to ledger. At any point, you're only working with one CSV file from one account.The classifier is built to aid in categorizing the expenses; which is the hard part. To classify, it must have at least 2 classes; which makes sense. And, most valid use cases of ledger would have at least a few expense categories; without which even ledger wouldn't be very helpful. So, I'd say the thing is working as expected.
Haven't had any updates on this. Closing the thread; if you need any further action, feel free to reopen.
Thanks for this tool! It's been making using ledger a lot easier. Although I think it's easy to use once you have it set up, getting it set up was a bit of a pain because there were several points where I couldn't figure out what I was doing wrong. I encountered the following issues during configuration of into-ledger, and I think the error messages could do a better job of helping the user along in each of these cases:
1.
This was confusing because I had created
/home/david/.into-ledger/config.yaml
, but for some reason into-ledger was saying it couldn't find it. The problem turned out to be that I wrote "accouts" instead of "accounts" in config.yaml. An error like "Unrecognized key 'accouts' in config.yaml" would have made it immediately obvious what the problem was.main.check /home/david/.go/src/github.com/manishrjain/into-ledger/main.go:85 main.parseTransactionsFromCSV /home/david/.go/src/github.com/manishrjain/into-ledger/main.go:336 main.main /home/david/.go/src/github.com/manishrjain/into-ledger/main.go:793 runtime.main /usr/lib/go/src/runtime/proc.go:183 runtime.goexit /usr/lib/go/src/runtime/asm_amd64.s:2086
$ into-ledger -a citizens -csv ~/Downloads/EXPORT_edit.CSV Opening file: /home/david/.into-ledger/shortcuts.yaml for reading key mappings Using config: {Currency:USD Journal:/home/david/Documents/finance/y2012-2016.txt DateFormat:1/2/06 Ignore:0,2,5,6,7 Output:/home/david/citizens.out Skip:1}
Unchanged keyboard shortcuts. Skipping overwrite to /home/david/.into-ledger/shortcuts.yaml. panic: provide at least two classes
goroutine 1 [running]: panic(0x57f7c0, 0xc42011ec10) /usr/lib/go/src/runtime/panic.go:500 +0x1a1 github.com/jbrukh/bayesian.NewClassifierTfIdf(0xc4201060a0, 0x1, 0xa, 0x0) /home/david/.go/src/github.com/jbrukh/bayesian/bayesian.go:158 +0x4ff main.(*parser).generateClasses(0xc42003bd88) /home/david/.go/src/github.com/manishrjain/into-ledger/main.go:185 +0x30c main.main() /home/david/.go/src/github.com/manishrjain/into-ledger/main.go:789 +0xd23