Thanks  for the pointer Tim,

I tried your recommendation and am able to run the snippet above with 
ledger python my_program.py.

-cb

On Monday, June 17, 2013 8:55:31 AM UTC-7, Tim Crews wrote:
>
>
>
> On Saturday, June 15, 2013 11:34:16 PM UTC-7, c b wrote:
>>
>> Hi,
>>
>> I just built ledger 3.0 from sources on a Debian wheezy system with 
>> prefix=/opt/local/
>>
>> I'm a python noob and  cannot figure out how to enable python bindings or 
>> where they will be installed
>>
>> Any pointers will be appreciated.
>>
>> Thanks,
>> cb
>>
>
> cb:
>
> Once you've successfully build ledger with the  USE_PYTHON setting 
> enabled, that's as enabled as the Python bindings get.  The bindings are 
> built into the ledger executable itself; there is nothing else to install 
> other than ledger.
>
> You access the Python bindings by executing ledger with the python 
> sub-command, i.e.
>
>     ledger python
>
> You will then be placed in a Python environment that has access to the 
> Ledger Python bindings.  If you have a Python program that needs to access 
> the Ledger bindings, run it like:
>
>     ledger python my_program.py
>
> It is not currently possible to import ledger in a standalone Python 
> program or module without running the ledger python command first.
>
> In the example Python code found at 
> http://www.ledger-cli.org/3.0/doc/ledger3.html#Extending-with-Python, 
> note that the calls to xacts and posts should be followed by parentheses, 
> i.e. the example should actually read:
>
>
>         import ledger
>      
>         for xact in ledger.read_journal("sample.dat").xacts():
>             for post in xact.posts():
>                 print "Transferring %s to/from %s" % (post.amount, 
> post.account)
>
>
> I hope this is enough to get you started.  
>
> Tim Crews
>

-- 

--- 
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/groups/opt_out.


Reply via email to