include directives in ledger 3.2.1 and ledger-reconcile

29 views
Skip to first unread message

Richard Lawrence

unread,
Jan 1, 2022, 11:08:48 AM1/1/22
to Ledger
Hi everyone,

I recently switched from ledger 3.1.22-20190205 (in Debian oldstable) to
3.2.1-20200518 (in GNU Guix) and I'm encountering the following issue.
At the top of my ledger file are two include directives:

include strict.db
include prices.db

The two included files are in the same directory as the ledger file.
But after upgrading, when I try to reconcile an account using
ledger-reconcile in Emacs' ledger-mode, I get the following errors:

While parsing file "", line 1:
Error: File to include was not found: "strict.db"
While parsing file "", line 2:
Error: File to include was not found: "prices.db"

I'm not sure exactly what the cause of this is, but I did confirm that
the issue does not occur if I switch back to ledger 3.1.2.
It also goes away if I enter full absolute paths for the files, but not
relative paths like "./prices.db".

I also found this issue about include directives:

https://github.com/ledger/ledger/issues/1659

which resulted in this change:

https://github.com/emin63/ledger/commit/9c1a7b1b1dbad11196571b1114ddaf23ae5345ff

Could this be related to the problem? Is it now required to specify
absolute paths in include directives?

Many thanks for your insights?

--
Best,
Richard

Colin Dean

unread,
Jan 1, 2022, 1:45:09 PM1/1/22
to Ledger
I'm using ledger 3.2.1-7build2 from ubuntu impish in the particular records I'm looking at right now. My includes are using "!include" are relative but my setup is different. I invoke ledger on a file that contains the commodity decls and then includes the activity file (and a file with opening balances in previous years, but for 2019+ I did everything in one file).

Richard Lawrence

unread,
Jan 2, 2022, 2:32:00 PM1/2/22
to Colin Dean, Ledger
Hi Colin and all,

Colin Dean <c...@cad.cx> writes:

> I'm using ledger 3.2.1-7build2 from ubuntu impish in the particular records
> I'm looking at right now. My includes are using "!include" are relative

Thanks, that's good to know.

To be clear, ledger itself still seems to read the included files (with
relative paths) just fine when I run it from the command line. I only
see the error when it is run via ledger-mode in emacs. But I do not see
the problem with ledger 3.1.2, so I suspect something changed in ledger
between 3.1.2 and 3.2.1 (or between the Debian build and the Guix build)
that ledger-mode was implicitly relying on.

I am suspicious of the fact that ".path()" was dropped in the last
part of the diff here:

https://github.com/emin63/ledger/commit/9c1a7b1b1dbad11196571b1114ddaf23ae5345ff

I don't know exactly what .path() does, but could that have something to do
with this issue? It would be great if someone familiar with the source
code could chime in on this.

Thanks in advance!

--
Best,
Richard
Reply all
Reply to author
Forward
0 new messages