into-ledger icon indicating copy to clipboard operation
into-ledger copied to clipboard

Unable to parse CSV transactions

Open RyanMcCarl opened this issue 8 years ago • 6 comments

I am very interesting in your program, but I can't get it to parse CSV transactions at all.

bash-4.3$ ./into-ledger -a "Chase Freedom" -csv /home/ryan/ledger/private/chasefreedom.csv
Opening file: /home/ryan/.into-ledger/shortcuts.yaml for reading key mappings
File /home/ryan/.into-ledger/shortcuts.yaml doesn't exist. Creating empty shortcuts
Using config: {Currency:USD Journal:/home/ryan/notes/ledger.dat DateFormat:01/02/2006 Ignore:2,4,6,7,8 Output:/home/ryan/ledger/private/chasefreedom.out Skip:1}
2017/01/17 09:51:14 %!(EXTRA []interface {}=[])
2017/01/17 09:51:14 
2017/01/17 09:51:14 Unable to parse txn for [9/30/2013 Hubbard Inn HUBBARD INN 23 debit Alcohol & Bars Chase Freedom CC  ]
. Got: {Date:0001-01-01 00:00:00 +0000 UTC Desc:Alcohol & Bars To: From: Cur:23 CurName: Key:[38 92 34 179 66 137 128 67 221 200 22 229 48 174 105 152] skipClassification:false Done:false}

main.check
	/home/ryan/go/src/src/github.com/manishrjain/into-ledger/main.go:86
main.parseTransactionsFromCSV
	/home/ryan/go/src/src/github.com/manishrjain/into-ledger/main.go:337
main.main
	/home/ryan/go/src/src/github.com/manishrjain/into-ledger/main.go:809
runtime.main
	/usr/lib/golang/src/runtime/proc.go:183
runtime.goexit
	/usr/lib/golang/src/runtime/asm_amd64.s:2086

Thank you!

RyanMcCarl avatar Jan 17 '17 16:01 RyanMcCarl

Hi @RyM21,

The issue isn't clear here -- into-ledge is unable to parse date. I've updated the code to make the resulting issue clearer. Can you please run go get -u -v github.com/manishrjain/into-ledger, retry and report what you see.

manishrjain avatar Jan 21 '17 22:01 manishrjain

Hi! I tried it and got the same result. Another problem I forgot to mention is that into-ledger freezes my terminal after running the command; maybe there is a process still running?

Opening file: /home/ryan/.into-ledger/shortcuts.yaml for reading key mappings
Using config: {Currency:USD Journal:/home/ryan/ledger/ledger-private/ledger.dat DateFormat:01/02/2006 Ignore:2,4,6,7,8 Output:/home/ryan/ledger/ledger-private/chasefreedom.out Skip:1}
2017/01/21 15:53:12 %!(EXTRA []interface {}=[])
2017/01/21 15:53:12 
2017/01/21 15:53:12 Unable to parse txn for [9/30/2013 Hubbard Inn HUBBARD INN 23 debit Alcohol & Bars Chase Freedom CC  ]
. Got: {Date:0001-01-01 00:00:00 +0000 UTC Desc:Alcohol & Bars To: From: Cur:23 CurName: Key:[108 71 77 104 124 35 106 180 101 221 105 43 102 48 86 1] skipClassification:false Done:false}

main.check
	/home/ryan/go/src/src/github.com/manishrjain/into-ledger/main.go:86
main.parseTransactionsFromCSV
	/home/ryan/go/src/src/github.com/manishrjain/into-ledger/main.go:337
main.main
	/home/ryan/go/src/src/github.com/manishrjain/into-ledger/main.go:809
runtime.main
	/usr/lib/golang/src/runtime/proc.go:183
runtime.goexit
	/usr/lib/golang/src/runtime/asm_amd64.s:2086
ryan@ryanfedora:~/ledger/ledger-private/csv$ 

RyanMcCarl avatar Jan 21 '17 22:01 RyanMcCarl

You're still on an older version. You need to update, using the command I mentioned above.

manishrjain avatar Jan 22 '17 00:01 manishrjain

Done. Tried with a new CSV and got this result. I specified the journal account in the settings.

ryan@ryanfedora:~/Dropbox/notes/ledger/ledger-private/csv$ into-ledger -csv boavisa.csv -o out.data -a "BOA Visa"Opening file: /home/ryan/.into-ledger/shortcuts.yaml for reading key mappings
Using config: {Currency: Journal: DateFormat: Ignore: Output: Skip:0}
	ERROR: Please specify the input ledger journal file 
Flags available:
  -a string
    	Name of bank account transactions belong to.
  -c string
    	Set currency if any.
  -conf string
    	Config directory to store various into-ledger configs in. (default "/home/ryan/.into-ledger")
  -csv string
    	File path of CSV file containing new transactions.
  -d string
    	Express your date format in numeric form w.r.t. Jan 02, 2006, separated by slashes (/). See: https://golang.org/pkg/time/ (default "01/02/2006")
  -debug
    	Additional debug information if set.
  -ic string
    	Comma separated list of columns to ignore in CSV.
  -j string
    	Existing journal to learn from.
  -o string
    	Journal file to write to. (default "out.ldg")
  -s int
    	Number of header lines in CSV to skip


Unchanged keyboard shortcuts. Skipping overwrite to /home/ryan/.into-ledger/shortcuts.yaml.

Here is my config file with that account and the Chase one:

accounts:
  "Chase Freedom":
    c: USD
    j: /home/ryan/ledger/ledger-private/ledger.dat
    d: 01/02/2006
    o: /home/ryan/ledger/ledger-private/chasefreedom.out
    s: 1
    ic: "2,4,6,7,8"
  "BOA Visa":
    c: USD
    j: /home/ryan/ledger/ledger-private/ledger.dat
    d: 01/02/2006
    o: /home/ryan/ledger/ledger-private/boavisa.out
    ic: "2,4,6,7,8"
    s: 1

When I tried again specifying the journal file, I got the same message as before. It also froze my terminal again so it wouldn't accept keyboard input:

ryan@ryanfedora:~/Dropbox/notes/ledger/ledger-private/csv$ into-ledger -csv boavisa.csv -o out.data -a "BOA Visa" -j /home/ryan/ledger/ledger-private/ledger.dat
Opening file: /home/ryan/.into-ledger/shortcuts.yaml for reading key mappings
Using config: {Currency: Journal: DateFormat: Ignore: Output: Skip:0}
2017/01/22 15:04:26 %!(EXTRA []interface {}=[])
2017/01/22 15:04:26 
2017/01/22 15:04:26 Unable to parse txn for [Date Description Original Description Amount Transaction Type Category Account Name Labels Notes]
. Got: {Date:0001-01-01 00:00:00 +0000 UTC Desc:Notes To: From: Cur:0 CurName: Key:[212 82 72 216 247 163 222 81 5 137 193 118 157 146 133 18] skipClassification:false Done:false}

main.check
	/home/ryan/go/src/src/github.com/manishrjain/into-ledger/main.go:86
main.parseTransactionsFromCSV
	/home/ryan/go/src/src/github.com/manishrjain/into-ledger/main.go:337
main.main
	/home/ryan/go/src/src/github.com/manishrjain/into-ledger/main.go:809
runtime.main
	/usr/lib/golang/src/runtime/proc.go:183
runtime.goexit
	/usr/lib/golang/src/runtime/asm_amd64.s:2086
ryan@ryanfedora:~/Dropbox/notes/ledger/ledger-private/csv$ 

RyanMcCarl avatar Jan 22 '17 22:01 RyanMcCarl

Unfortunately, you're still on the older version of master. The error message: Unable to parse txn for is no longer in the HEAD. Have you been following the command I have been mentioning here?

Here's how you can check which version of code you're on.

$ cd $GOPATH/github.com/manishrjain/into-ledger
$ git log # Check the top commit.

commit 870acb435f9f507f42f39718088b41dbae9a48f5
Author: Manish R Jain <[email protected]>
Date:   Sun Jan 22 20:14:56 2017 +1100

    Only parse the day from csv txns.

# To update your version of code, run
$ git pull
$ go install .

Please report back once you do them. If you upgrade, the terminal "freezing" up would also be resolved.

manishrjain avatar Jan 22 '17 23:01 manishrjain

I have been entering the exact command you gave me; I'll try again with the git commands above. Thank you.

RyanMcCarl avatar Jan 24 '17 01:01 RyanMcCarl