ParIT's package and Python bindings examples?

... offonoffoffonoff at gmail.com
Fri Sep 17 17:28:52 EDT 2010


Finally think I have gnucash 2.2.9 built on my ubuntu 9.04 machine.  But, i
am not sure that the python bindings included with it are workable.  I was
not able to execute sample code.

Used

http://www.parit.ca/products/finance/apt-repository

used
sudo apt-get install gnucash
sudo apt-get source gnucash

found modules in /usr/lib/python2.5/site-packages/gnucash/  which is already
in my path.

But i did not find any example code in the unpacked source
(/home/elliot/gnucash-2.2.9/src/optional/python bindings/)  I downloaded an
example linked to from the gnucash wiki

http://svn.gnucash.org/trac/browser/gnucash/trunk/src/optional/python-bindings/example_scripts

So i have executable code from ParIT's site and a python example from the
gnucash repo (which i was unable to build)

I copied the execute statement from the description in
simple_business_create.py to the shell and executed it.  Did not work.  I
know that the PYTHONPATH is correct because previously I was accidentally
using my python2.6 executable, which does not have the gnucash modules in
its PYTHONPATH and the error was like "cannot find gnucash".  The error
below is better (it found gnucash but couldn't find a specific detail)


elbiot at elbitop:/usr/lib/python2.5/site-packages/gnucash$ gnucash-env
/usr/bin/python2.5 /home/elbiot/Desktop/tmp/simple_business_create.py
sqlite3:///home/blah/blah.gnucash
Traceback (most recent call last):
  File "/home/elbiot/Desktop/tmp/simple_business_create.py", line 41, in
<module>
    from gnucash.gnucash_business import Customer, Employee, Vendor, Job, \
ImportError: cannot import name Job

I deleted all referances to Job and got "Cannot import Invoice" next.

so:

1) can I/ should I use the ParIT package to begin working with the python
bindings? Perhaps it just has a slightly reduced set of non-critical
functions but still works and has functionality.

2) if so, where can I find an example that will work with this build?  Or do
I need to keep deleting portions of example code from trunk until I find
what functions I have access to?

3) is there a manual work around,like copying the python source from trunk
into my python path, and by that get access to Job, Invoice and whatever
else.  Or are there changes to the compiled gnucash that need to accompany
the existence of new objects in the interpreted python code.

( re #3: Despite my better judgement but because I have two different python
executables with different paths, I copied trunk's python code from
http://svn.gnucash.org/trac/browser/gnucash/trunk/src/optional/python-bindingsto
a directory into a directory in python's path so python had only
trunks
python code and I got a "cannot import gnucash_core_c", then I copied
ParIT's python files into the same directory, overwriting whatever trunk
files had the same name and got "cannot import Job", finally, I rewrote
trunk's python code into the directory, overwriting some files.  in this
final step, most of the files were still ParIT's, with a small set of them
being from trunk.  I got "cannot import name gncInvoiceLookup" which is
supposedly in gnucash_core_c.  seems like progress but also seems to not be
going anywhere.

If #3 is possible I'll need some direction.)

wow, you read all this?  thanks.


More information about the gnucash-devel mailing list