Re: Python API segmentation faults (was: Charts software for ledger?)

2016-04-20 Thread Metin Akat
This is a bug report that shows how/when/why it crashes:
http://bugs.ledger-cli.org/show_bug.cgi?id=1163
The same thing happens (for me) when I access it via Python
It only happens with larger files (mine has ~20k transactions).

On Thu, Apr 21, 2016 at 3:16 AM, Craig Earls  wrote:

> I have been using ledger happily for five years now. I just havent put
> much effort into.
>
>
> On Wednesday, April 20, 2016, Ben Finney 
> wrote:
>
>> "Manuel Amador (Rudd-O)"
>>  writes:
>>
>> > On 04/20/2016 09:00 PM, Craig Earls wrote:
>> > > Since i have never gotten python to work without segfaults i cant
>> > > answer
>>
>> We are talking about the Python API supplied as part of the Ledger
>> distribution?
>>
>> > After writing a small app that iterates through Ledger transactions and
>> > plots them, it has become exceedingly clear that you were right.  Simply
>> > going over a query() result causes it to crash or to come up with absurd
>> > errors like "Year must be between 1400...1".
>>
>> Can you direct us to the bug reports detailing these problems?
>>
>> --
>>  \  “A thing moderately good is not so good as it ought to be. |
>>   `\Moderation in temper is always a virtue; but moderation in |
>> _o__)   principle is always a vice.” —Thomas Paine |
>> Ben Finney
>>
>> --
>>
>> ---
>> 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 ledger-cli+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Craig, Corona De Tucson, AZ
> enderw88.wordpress.com
>
> --
>
> ---
> 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 ledger-cli+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Python API segmentation faults

2016-04-20 Thread John Wiegley
> Manuel Amador (Rudd-O)  writes:

> Old report is available as one of my pull requests in the ledger/ledger
> Github repo. Which, by the way, remains unmerged.

Sorry about that; merged now.

-- 
John Wiegley  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com  60E1 46C4 BD1A 7AC1 4BA2

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Python API segmentation faults

2016-04-20 Thread Manuel Amador (Rudd-O)
On 04/20/2016 11:23 PM, Ben Finney wrote:
> "Manuel Amador (Rudd-O)"
>  writes:
>
>> On 04/20/2016 09:00 PM, Craig Earls wrote:
>>> Since i have never gotten python to work without segfaults i cant
>>> answer
> We are talking about the Python API supplied as part of the Ledger
> distribution?

Yes.

>
>> After writing a small app that iterates through Ledger transactions and
>> plots them, it has become exceedingly clear that you were right.  Simply
>> going over a query() result causes it to crash or to come up with absurd
>> errors like "Year must be between 1400...1".
> Can you direct us to the bug reports detailing these problems?
>

Old report is available as one of my pull requests in the ledger/ledger
Github repo.  Which, by the way, remains unmerged.

Sigh.

-- 
Rudd-O
http://rudd-o.com/

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Python API segmentation faults (was: Charts software for ledger?)

2016-04-20 Thread Craig Earls
I have been using ledger happily for five years now. I just havent put much
effort into.

On Wednesday, April 20, 2016, Ben Finney  wrote:

> "Manuel Amador (Rudd-O)"
> > writes:
>
> > On 04/20/2016 09:00 PM, Craig Earls wrote:
> > > Since i have never gotten python to work without segfaults i cant
> > > answer
>
> We are talking about the Python API supplied as part of the Ledger
> distribution?
>
> > After writing a small app that iterates through Ledger transactions and
> > plots them, it has become exceedingly clear that you were right.  Simply
> > going over a query() result causes it to crash or to come up with absurd
> > errors like "Year must be between 1400...1".
>
> Can you direct us to the bug reports detailing these problems?
>
> --
>  \  “A thing moderately good is not so good as it ought to be. |
>   `\Moderation in temper is always a virtue; but moderation in |
> _o__)   principle is always a vice.” —Thomas Paine |
> Ben Finney
>
> --
>
> ---
> 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 ledger-cli+unsubscr...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Craig, Corona De Tucson, AZ
enderw88.wordpress.com

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Python API segmentation faults (was: Charts software for ledger?)

2016-04-20 Thread Ben Finney
"Manuel Amador (Rudd-O)"
 writes:

> On 04/20/2016 09:00 PM, Craig Earls wrote:
> > Since i have never gotten python to work without segfaults i cant
> > answer

We are talking about the Python API supplied as part of the Ledger
distribution?

> After writing a small app that iterates through Ledger transactions and
> plots them, it has become exceedingly clear that you were right.  Simply
> going over a query() result causes it to crash or to come up with absurd
> errors like "Year must be between 1400...1".

Can you direct us to the bug reports detailing these problems?

-- 
 \  “A thing moderately good is not so good as it ought to be. |
  `\Moderation in temper is always a virtue; but moderation in |
_o__)   principle is always a vice.” —Thomas Paine |
Ben Finney

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Charts software for ledger?

2016-04-20 Thread Manuel Amador (Rudd-O)
On 04/20/2016 09:00 PM, Craig Earls wrote:
> Since i have never gotten python to work without segfaults i cant answer

After writing a small app that iterates through Ledger transactions and
plots them, it has become exceedingly clear that you were right.  Simply
going over a query() result causes it to crash or to come up with absurd
errors like "Year must be between 1400...1".  Furthermore, for some
reason now my GUI apps that used to work throw out balance errors.

Really shoddy quality.  Can't wait to switch to Beancount.

-- 
Rudd-O
http://rudd-o.com/

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ledger Python balances at date?

2016-04-20 Thread Manuel Amador (Rudd-O)
On 04/20/2016 09:29 PM, Martin Blais wrote:
> For plotting net worth, you don't need every day, every week or every
> month is plenty sufficient.
> And you'll have to reconcile all of these to a single currency.
>
> Given how fast Ledger is, it's conceivable to run a loop and make
> multiple invocations of the binary for each week and parse its output
> and plot in a reasonable amount of time.

It's not that fast for me, even for something weekly.

I strongly prefer direct Python API access over parsing the output of
subprocess.Popen.  Anything that looks remotely like parsing that output
is a non-starter for my needs.

-- 
Rudd-O
http://rudd-o.com/

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: ledger Python balances at date?

2016-04-20 Thread Martin Blais
For plotting net worth, you don't need every day, every week or every month
is plenty sufficient.
And you'll have to reconcile all of these to a single currency.

Given how fast Ledger is, it's conceivable to run a loop and make multiple
invocations of the binary for each week and parse its output and plot in a
reasonable amount of time.





On Wed, Apr 20, 2016 at 5:22 PM, Manuel Amador (Rudd-O) 
wrote:

> Hello!  How can I query the ledger module / the ledger Journal object
> within Python, to obtain a balance at a particular date?
>
> I would very much not rather launch a binary for every day of the past 5
> years or so.
>
> --
> Rudd-O
> http://rudd-o.com/
>
> --
>
> ---
> 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 ledger-cli+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ledger Python balances at date?

2016-04-20 Thread Manuel Amador (Rudd-O)
Hello!  How can I query the ledger module / the ledger Journal object
within Python, to obtain a balance at a particular date?

I would very much not rather launch a binary for every day of the past 5
years or so.

-- 
Rudd-O
http://rudd-o.com/

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Charts software for ledger?

2016-04-20 Thread Manuel Amador (Rudd-O)
On 04/20/2016 09:00 PM, Craig Earls wrote:
> Since i have never gotten python to work without segfaults i cant answer

My trick is to load a new Journal object after a Query, otherwise it
segfaults.

-- 
Rudd-O
http://rudd-o.com/

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Charts software for ledger?

2016-04-20 Thread Manuel Amador (Rudd-O)
On 04/20/2016 08:47 PM, Martin Blais wrote:
> On Wed, Apr 20, 2016 at 3:43 PM, Manuel Amador (Rudd-O)
> > wrote:
>
>
> Why isn't there anything like that?  
>
>
> You mean like this?
> https://bitbucket.org/blais/beancount/src/8ac805ab793f96594871a1594e72f4039bbc2ee3/experiments/compensation/net-worth-over-time.py?at=default=file-view-default
>

Pretty much.  Does this mean I must switch to Beancount?


-- 
Rudd-O
http://rudd-o.com/

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Charts software for ledger?

2016-04-20 Thread Craig Earls
Since i have never gotten python to work without segfaults i cant answer

On Wednesday, April 20, 2016, Manuel Amador (Rudd-O) 
wrote:

> Hi!  I'm looking for a program that will help me chart my net worth and
> other such things such as expenses.
>
> The few programs I have found have deplorable installation instructions
> ("run this program, it will download some mystery meat from the
> Internets, then put some files here, then create a configuration file")
> and have questionable security practices ("then run this other program,
> which starts an HTTP server on your local machine").
>
> Nothing of the sort is necessary if a good desktop application is
> written using libraries that are readily available in most Linux
> distributions.  To wit, my ledgerhelpers helpers are desktop apps, they
> require no configuration at all, and they work with your existing setup
> (modulo a few format limitations).
>
> Why isn't there anything like that?  How hard can it be to load data
> from ledger using its Python bindings, then plot it using something like
> pygtkchart or kqtquickcharts?
>
> Anyway, just my thoughts.
>
> --
> Rudd-O
> http://rudd-o.com/
>
> --
>
> ---
> 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 ledger-cli+unsubscr...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Craig, Corona De Tucson, AZ
enderw88.wordpress.com

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Charts software for ledger?

2016-04-20 Thread Martin Blais
On Wed, Apr 20, 2016 at 3:43 PM, Manuel Amador (Rudd-O) 
wrote:

> Hi!  I'm looking for a program that will help me chart my net worth and
> other such things such as expenses.
>
> The few programs I have found have deplorable installation instructions
> ("run this program, it will download some mystery meat from the
> Internets, then put some files here, then create a configuration file")
> and have questionable security practices ("then run this other program,
> which starts an HTTP server on your local machine").
>
> Nothing of the sort is necessary if a good desktop application is
> written using libraries that are readily available in most Linux
> distributions.  To wit, my ledgerhelpers helpers are desktop apps, they
> require no configuration at all, and they work with your existing setup
> (modulo a few format limitations).
>
> Why isn't there anything like that?


You mean like this?
https://bitbucket.org/blais/beancount/src/8ac805ab793f96594871a1594e72f4039bbc2ee3/experiments/compensation/net-worth-over-time.py?at=default=file-view-default

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Charts software for ledger?

2016-04-20 Thread Manuel Amador (Rudd-O)
Hi!  I'm looking for a program that will help me chart my net worth and
other such things such as expenses.

The few programs I have found have deplorable installation instructions
("run this program, it will download some mystery meat from the
Internets, then put some files here, then create a configuration file")
and have questionable security practices ("then run this other program,
which starts an HTTP server on your local machine").

Nothing of the sort is necessary if a good desktop application is
written using libraries that are readily available in most Linux
distributions.  To wit, my ledgerhelpers helpers are desktop apps, they
require no configuration at all, and they work with your existing setup
(modulo a few format limitations).

Why isn't there anything like that?  How hard can it be to load data
from ledger using its Python bindings, then plot it using something like
pygtkchart or kqtquickcharts?

Anyway, just my thoughts.

-- 
Rudd-O
http://rudd-o.com/

-- 

--- 
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 ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using ledger for shared expenses

2016-04-20 Thread Erik Hetzner
Hi Sébastien,

Here are two ways to do it. I don’t see how the joint account fits in this
scenario, so I’ve ignored it.

First, the simple way:

2016/01/01 Transfer
  Assets:Bank:Checking   $750
  Expenses:Rent -$750

2016/01/01 Rent payment
  Assets:Bank:Checking -$1500
  Expenses:Rent $1500

This is from Bob’s point of view - his expenses are $750 in rent, and he doesn’t
care what Alice’s expense are or what her bank account looks like.

A more complicated way:

2016/01/01 Transfer
  Assets:Bank:Checking   $750
  Liabilities:Rent  -$750

2016/01/01 Rent payment
  Assets:Bank:Checking -$1500
  Liabilities:Rent   $750
  Expenses:Rent  $750

This is also from Bob’s p.o.v. He doesn’t care about Alice’s expenses, but he
does care that Alice has lent him $750 for rent and he wants to make sure that
he has paid his debt (though his debt was paid to the landlord). So before the
2nd transaction is used, he will have a negative balance in Liabilities:Rent.

More complicated still:

2016/01/01 Transfer
  Assets:Bank:Bob:Checking   $750
  Assets:Bank:Alice:Checking-$750
  Expenses:Alice:Rent$750
  Liabilities:Bob:Rent  -$750

2016/01/01 Rent payment
  Assets:Bob:Bank:Checking -$1500
  Liabilities:Bob:Rent   $750
  Expenses:Bob:Rent  $750

In this case, we are tracking Alice & Bob’s expenses and accounts. In the first
transaction, the transfer happens between accounts, Alice has paid her rent, and
Alice has loaned $750 to Bob for her share of the rent. In the second, Bob pays
off the debt to Alice and pays the rent.

That is how I would handle it. I am no accountant, but I have used ledger for
situations like this. :)

If you want to bring automated transactions into this, give it a shot, but they
are not as expressive as regular ledger.

best, Erik

On Tue, 19 Apr 2016 07:52:08 -0700,
Sébastien Gross  wrote:
>
> [1.1  ]
> Hi there,
>
> This might be an ultra-classic use-case of ledger here I am facing.
>
> Let's plot the scene:
>
>
> - They have their own bank account (Alice and Bob) and a Join account
>
> - Alice and Bob rent a flat ($1500/mo), which for some reasons is paid
>   by Bob from his own account (not for the Join one).
>
> - Every month Alice wires half the rent ($750) to Bob's checking account
> - Every month wire the rent to the owner
>
>
> For clean readability I always use the following scheme:
>   (Assets|Income|Expenses|Liabilities|Equity):(Alice|Bob|Join):Account
>
>
> I assume the following opening balances:
>
>   2016/01/01 * Opening balance
>   Assets:Bob:Bank:Checking$12345
>   Equity:Bob:Bank:Checking
>
>   2016/01/01 * Opening balance
>   Assets:Join:Bank:Checking $123
>   Equity:Join:Bank:Checking
>
>
> This can be written as follow:
>
>
>   2016/01/01 Alice
>   Assets:Bob:Bank:Checking  $750
>   Income:Bob:Alice:Rent
>
>   2016/01/01 Owner
>   Assets:Bob:Bank:Checking
>   Expenses:Bob:Rent$1500
>
> The balance is then:
>
>   $ ./test.ledger bal
> $11718  Assets
> $11595Bob:Bank:Checking
>   $123Join:Bank:Checking
>$-12468  Equity
>$-12345Bob:Bank:Checking
>  $-123Join:Bank:Checking
>  $1500  Expenses:Bob:Rent
>  $-750  Income:Bob:Alice:Rent
>   
>  0
>
> This is good and works fine but hides a few things:
>
> a) Who pays the rent
> b) If Alice made a mistake in the wire there is no way to check it
> c) An extra income is shown for Bob which should disappear after bob
>paid the rent
>
> I thus add a few automatic rules such as:
>
>   =/^Expenses:Bob:Rent$/
>   $account  -1
>   Expenses:Join:Alice:Rent   0.5
>   Expenses:Join:Bob:Rent 0.5
>   ;
>   Income:Bob:Alice:Rent  0.5
>   Income:Join:Alice:Rent-0.5
>
>
> The goal here is to split Bob's rent expense into 2 Expenses for the
> Join accounting and transfers the Bob's income to the Join account.
>
> Now the result is better:
>
>   $ ./test.ledger bal
> $11718  Assets
> $11595Bob:Bank:Checking
>   $123Join:Bank:Checking
>$-12468  Equity
>$-12345Bob:Bank:Checking
>