documentation for python bindings

Mark Jenkins mark at parit.ca
Thu Jul 24 01:50:52 EDT 2008


> Is this correct?  Manipulation of the gnucash file from the python
> bindings is possible (rw)?

Yes.

> What I am trying to do is open a gnucash file, find the account
> identified by code 1234 and mark it as tax relevant.  Would you be so
> kind to help me with that?

Yes, attached.

> The steps outlined in
> http://wiki.gnucash.org/wiki/Python_Bindings#setting_things_up produce
> an error initially, importing __init__ a second time runs fine.  Is that
> a bug?  I am still very inexperienced with this.  All I can say is that
> setting the PYTHONPATH and then running your example scripts with
> "python $script" on hardy produces a very similarly looking error about
> "could not locate gnucash/engine interface v.0".

If I was to document anything, I should of at least documented this, not
only do you need the right stuff in your PYTHONPATH (or for it to be in
python's automatic search path), but you need to run python with
/gnucash-env/ in front of it.

So, you should be able to set your PYTHONPATH and run the attachment as
follows:
$ gnucash-env ./mark_as_tax_related.py
or
$ gnucash-env python mark_as_tax_related.py


> (process:11900): GLib-CRITICAL **: g_hash_table_lookup: assertion
> `hash_table != NULL' failed

I get assertions like this too. Though I haven't investigated them, I
can say that things still work despite them.


Also, I don't really see much point in importing gnucash.__init__ . It's
there so you can do things like

>>> from gnucash import Session

instead of


>>> from gnucash.gnucash_core import Session



Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mark_as_tax_related.py
Type: text/x-python
Size: 955 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20080724/9d32b102/attachment.py 


More information about the gnucash-devel mailing list