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

3-journal/ files not ending in ".journal" extension are added to yearly include files #92

Closed
lestephane opened this issue Feb 1, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@lestephane
Copy link

Describe the bug
I cheat a bit and add, next to each .journal file in 3-journal, a .png of a related invoice, and a .json of the google text detection api response. These extra files used to be ignored by hledger-flow import, now they get added to the yearly include, causing hledger to fail:

  |
6 | !include 3-journal/2019/2019-05-31-000.png
  |                                           ^
SourcePos {sourceName = "SCRUBBED/Finance/import/personal/wallet/cash/2019-include.journal", sourceLine = Pos 6, sourceColumn = Pos 43} reading SCRUBBED/Finance/import/personal/wallet/cash/3-journal/2019/2019-05-31-000.png:
SCRUBBED/Finance/import/personal/wallet/cash/3-journal/2019/2019-05-31-000.png: hGetContents: invalid argument (invalid byte sequence)

Version and Runtime Information

hledger-flow-v0.14.2.0

Is this the latest version? yes
Please confirm your issue using the latest version of hledger-flow, maybe it has already been fixed.

Also include the runtime options of the command you ran, e.g:

The enable-future-rundir option is now the default, no need to specify it. This option is currently being ignored and will be removed in future.
RuntimeOptions {baseDir = "SCRUBBED/Finance/", importRunDir = "import/personal/wallet/cash/", importStartYear = Nothing, onlyNewFiles = False, hfVersion = "hledger-flow 0.14.2.0 linux x86_64 ghc 8.10", hledgerInfo = HledgerInfo {hlPath = FilePath "SCRUBBED/Finance/hledger", hlVersion = "hledger 1.20.2"}, sysInfo = SystemInfo {os = "linux", arch = "x86_64", compilerName = "ghc", compilerVersion = Version {versionBranch = [8,10], versionTags = []}}, verbose = False, showOptions = True, sequential = False}
Collecting input files from SCRUBBED/Finance/import/personal/wallet/cash/
Found 100 input files in 0.024561536s. Proceeding with import...

To Reproduce

Add files in 3-journal as part of a construct script

Expected behavior

One of:

  • ignore non- .journal extensions in 3-journal
  • make the list of extensions that will be included in the yearly include configurable...
@lestephane lestephane added the bug Something isn't working label Feb 1, 2021
@lestephane
Copy link
Author

lestephane commented Feb 1, 2021

The workaround is to remove all include lines that do not contain .journal from include files:

sed -i -e 's/^!include.*\.\(png\|json\)$/#\0/g' [0-9][0-9][0-9][0-9]-include.journal

@apauley
Copy link
Owner

apauley commented Feb 2, 2021

I haven't even considered putting other files in the journal dir, but I guess there's no reason this shouldn't be possible 😃

I'll have a look at it within the next 2 or 3 days, hopefully it is an easy fix.

@lestephane
Copy link
Author

lestephane commented Feb 2, 2021 via email

@apauley apauley closed this as completed in b1d86db Feb 6, 2021
@apauley
Copy link
Owner

apauley commented Feb 7, 2021

Released as version 0.14.3

@lestephane
Copy link
Author

Thanks, I will try it at the end of the month when I do the next round of bookkeeping.

@lestephane
Copy link
Author

Verified! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants