Difference between revisions of "Python Bindings"
(→Setting things up) |
(→Documentation) |
||
Line 26: | Line 26: | ||
* Have a look at the page [http://svn.gnucash.org/docs/HEAD/python_bindings_page.html python-bindings] in [[doxygen]] source-documentation | * Have a look at the page [http://svn.gnucash.org/docs/HEAD/python_bindings_page.html python-bindings] in [[doxygen]] source-documentation | ||
* [http://svn.gnucash.org/trac/browser/gnucash/trunk/src/optional/python-bindings/example_scripts example scripts] from the source code and in [http://svn.gnucash.org/docs/HEAD/group__python__bindings__examples.html doxygen] | * [http://svn.gnucash.org/trac/browser/gnucash/trunk/src/optional/python-bindings/example_scripts example scripts] from the source code and in [http://svn.gnucash.org/docs/HEAD/group__python__bindings__examples.html doxygen] | ||
+ | * [http://svn.gnucash.org/docs/HEAD/group__Business.html business functions documentation] | ||
* inside ipython | * inside ipython | ||
** big long list of stuff | ** big long list of stuff |
Revision as of 15:13, 27 February 2012
Python bindings have been recently added to gnucash. There is still very little documentation and probably few people would know how to use it. While not a manual, this page was created in the hope to provide information for those interested in gnucash and python.
See also
- http://article.gmane.org/gmane.comp.gnome.apps.gnucash.devel/23800 "Re: documentation for python bindings" and
- http://article.gmane.org/gmane.comp.gnome.apps.gnucash.devel/23613 "Re: documentation for python bindings" with some pointers on how to look up the existing documentation
Setting things up
I use ipython for an interactive shell. If you prefer something else, let us know if there is any difference.
export PYTHONPATH=$PYTHONPATH:/export/gnucash/lib/python2.5/site-packages
This adds the gnucash python bindings to your PYTHONPATH assuming that your gnucash resides in /export/gnucash. You can then either start up an interactive python session with ipython or call your script to be executed.
gnucash-env ipython gnucash-env python $scriptyouwanttorun
Note: to install ipython run
sudo easy_install ipython
Documentation
As pointed out in the introductory paragraph, the documentation is rather slim at this point in time. Here are some sources where you might be able to find what you are looking for. Generally speaking, this is not yet end-user friendly stuff.
- Have a look at the page python-bindings in doxygen source-documentation
- example scripts from the source code and in doxygen
- business functions documentation
- inside ipython
- big long list of stuff
- import gnucash.gnucash_core_c
- help(gnucash_core_c)
- dir(gnucash_core_c)
- higher abstraction level help
- import gnucash.gnucash_core
- import gnucash.gnucash_business
- help(gnucash.gnucash_core)
- help(gnucash.gnucash_business)
- big long list of stuff
Again, http://article.gmane.org/gmane.comp.gnome.apps.gnucash.devel/23613 contains some more hopefully useful pointers.