I'm trying to use the Ledger Python Extension.  I have written a Python 
function to read a journal and return a dictionary mapping stock symbol to 
account name. I'm writing another Python function to calculate the Internal 
Rate of Return for one specified stock.  Hence, I have one Python script 
that attempts a second call to ledger.read_journal().  This second call 
always fails as shown below:

2017-08-14 14:46:49 /pri/git/Ledger4
> $ ./irr01.py -e 2010-01-01 VWO irr.json
> Traceback (most recent call last):
>   File "./irr01.py", line 81, in <module>
>     main()
>   File "./irr01.py", line 60, in main
>     journalx = ledger.read_journal(parameters.fpn_journal)
> RuntimeError: Assertion failed in 
> "/build/ledger-2L3TES/ledger-3.1.1+dfsg1/src/session.cc", line 
> 182:std::size_t ledger::session_t::read_data(const string&): xact_count == 
> journal->xacts.size()
> 2017-08-14 14:51:00 /pri/git/Ledger4
>

I have varied which call is second.  The second always fails.  I have 
looked in vain for a call that will "close" a ledger.Journal object or that 
will "close" or re-initialize the ledger library.  Associated with each 
call to ledger.read_journal(), there is a call to journal.query().  This 
query() iterates till it raises exception StopIteration.

Is each job/process allowed to make only one call to 
ledger.read_journal()?  This would be inconvenient and an unusual 
restriction to impose, but it could probably be accommodated.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to