Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--skip-dupes does not, somewhat unexpectedly, skip the prompts to enter payee and account #117

Open
cammil opened this issue May 19, 2018 · 3 comments

Comments

@cammil
Copy link

cammil commented May 19, 2018

It seems the prompt for entering payee and account still appears, even though that line of the csv has already been "dealt with".

What I got:

~ echo "2018/01/01,someshop,-5\n" > in.csv
~ icsv2ledger.py --skip-lines=0 --csv-date-format=%Y/%m/%d --credit 3 --debit 0 --desc 2 --skip-dupes --account Assets:Checking in.csv out.csv

2018/01/01 someshop                                 -5
Payee [someshop] >
Account [Expenses:Unknown] >
~ cat out.csv
2018/01/01 * someshop
    ; MD5Sum: 57d3077de9bff6d607111ed9e3a882d0
    ; CSV: 2018/01/01,someshop,-5
    Expenses:Unknown
    Assets:Bank:Current                                             £ -5

~ icsv2ledger.py --skip-lines=0 --csv-date-format=%Y/%m/%d --credit 3 --debit 0 --desc 2 --skip-dupes --account Assets:Checking in.csv out.csv

2018/01/01 someshop                                 -5
Payee [someshop] >
Account [Expenses:Unknown] >
~ cat out.csv
2018/01/01 * someshop
    ; MD5Sum: 57d3077de9bff6d607111ed9e3a882d0
    ; CSV: 2018/01/01,someshop,-5
    Expenses:Unknown
    Assets:Bank:Current                                             £ -5

What I expected:

~ echo "2018/01/01,someshop,-5\n" > in.csv
~ icsv2ledger.py --skip-lines=0 --csv-date-format=%Y/%m/%d --credit 3 --debit 0 --desc 2 --skip-dupes --account Assets:Checking in.csv out.csv

2018/01/01 someshop                                 -5
Payee [someshop] >
Account [Expenses:Unknown] >
~ cat out.csv
2018/01/01 * someshop
    ; MD5Sum: 57d3077de9bff6d607111ed9e3a882d0
    ; CSV: 2018/01/01,someshop,-5
    Expenses:Unknown
    Assets:Bank:Current                                             £ -5

~ icsv2ledger.py --skip-lines=0 --csv-date-format=%Y/%m/%d --credit 3 --debit 0 --desc 2 --skip-dupes --account Assets:Checking in.csv out.csv
<<<Nothing here, or perhaps some helpful message>>>
~ cat out.csv
2018/01/01 * someshop
    ; MD5Sum: 57d3077de9bff6d607111ed9e3a882d0
    ; CSV: 2018/01/01,someshop,-5
    Expenses:Unknown
    Assets:Bank:Current                                             £ -5
@RidaAyed
Copy link

@cammil Same here, any progress on that issue?

@TwoD
Copy link

TwoD commented Jan 12, 2019

For me it did not skip adding the records either. Every time I ran an import with --skip-dupes and the same input/output files I get new identical records appended to the output file, including the MD5 sums.

I noticed the code only checks the --skip-dupes if --skip-older-than isn't set, and I don't use that so no problem there. After some debugging I then noticed it never even parsed MD5 sums from my ledger file.

Turns out you have to also use the --ledger-file option to specify where it should read existing transactions from.

Something else I also realized is that NOT using --incremental for some reason truncates the outfile as soon as the program starts!
By the description it just sounds like leaving out --incremental just does not write anything to the output file until the input file is completely parsed, not that it will destroy any existing data as soon as you launch it without that option!

@jcrben
Copy link

jcrben commented Mar 14, 2019

Turns out you have to also use the --ledger-file option to specify where it should read existing transactions from.

Worked for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants