[GNC-dev] Fwd: Testing python

Mark epistemik at gmail.com
Tue Apr 21 09:01:33 EDT 2020


My bindings are built from the git source code for the 3.10 release
(gnucash-3.10.tar.bz2):

/opt/bin | Tue Apr 21 08:55:25 | marksa at Ares-A717-72G | bash 4.4.20
2013 > ./gnucash --version
GnuCash 3.10
Build ID: 3.10+(2020-04-11)

So maybe I have a slightly later version of 3.10 where this bug was already
fixed?


*Mark*
*epistemik at gmail.com <epistemik at gmail.com>*
*(613) 447-5385*



On Tue, Apr 21, 2020 at 8:33 AM Geert Janssens <geert.gnucash at kobaltwit.be>
wrote:

> Hi,
>
>
>
> I presume you are building from git. What commit are you building from ?
> There was an issue with detecting uninstalled builds that got fix right
> after the 3.10 release. So you'd need a very recent checkout to have this
> fix. This bug may be causing the symptoms you experience.
>
>
>
> Regards,
>
>
>
> Geert
>
>
>
> Op dinsdag 21 april 2020 05:15:53 CEST schreef Andy Goblins:
>
> > My environment seems much the same as yours. But for some reason, it
>
> > can't find the gncmod-backend-* files, which are compiled into the
>
> > build/lib/gnucash directory:
>
> >
>
> > Python 3.8.2 (default, Apr 8 2020, 14:31:25)
>
> > [GCC 9.3.0] on linux
>
> > Type "help", "copyright", "credits" or "license" for more information.
>
> >
>
> > >>> import sys
>
> > >>> print(sys.path)
>
> >
>
> > ['', '/usr/lib/python38.zip', '/usr/lib/python3.8',
>
> > '/usr/lib/python3.8/lib-dynload',
>
> > '/home/andy/hack/gnucash/build/lib/python3.8/site-packages',
>
> > '/home/andy/.local/lib/python3.8/site-packages',
>
> > '/usr/lib/python3.8/site-packages']
>
> >
>
> > >>> import gnucash
>
> >
>
> > * 22:04:55 WARN <gnc.engine> failed to load gncmod-backend-dbi from
>
> > relative path
>
> > * 22:04:55 ERROR <gnc.engine> required library gncmod-backend-dbi not
>
> > found.
>
> > * 22:04:55 WARN <gnc.engine> failed to load gncmod-backend-xml from
>
> > relative path
>
> > * 22:04:55 ERROR <gnc.engine> required library gncmod-backend-xml not
>
> > found.
>
> >
>
> > >>> import gnucash.gnucash_core_c
>
> > >>> print(gnucash.gnucash_core_c.CREC)
>
> >
>
> > c
>
> >
>
> > >>> exit()
>
> >
>
> > (build) ~/hack/gnucash/build > ls -a lib/python3.8/site-packages
>
> > total 40
>
> > drwxr-xr-x 9 andy andy 4096 Apr 16 18:06 .
>
> > drwxr-xr-x 3 andy andy 4096 Apr 16 17:46 ..
>
> > -rw-r--r-- 1 andy andy 126 Apr 16 18:06 easy_install.py
>
> > drwxr-xr-x 3 andy andy 4096 Apr 16 18:00 gnucash
>
> > drwxr-xr-x 5 andy andy 4096 Apr 16 18:06 pip
>
> > drwxr-xr-x 2 andy andy 4096 Apr 16 18:06 pip-19.2.3.dist-info
>
> > drwxr-xr-x 5 andy andy 4096 Apr 16 18:06 pkg_resources
>
> > drwxr-xr-x 2 andy andy 4096 Apr 16 18:06 __pycache__
>
> > drwxr-xr-x 6 andy andy 4096 Apr 16 18:06 setuptools
>
> > drwxr-xr-x 2 andy andy 4096 Apr 16 18:06 setuptools-41.2.0.dist-info
>
> > (build) ~/hack/gnucash/build > ls -a
>
> > lib/python3.8/site-packages/gnucash
>
> > total 2556
>
> > drwxr-xr-x 3 andy andy 4096 Apr 16 18:00 .
>
> > drwxr-xr-x 9 andy andy 4096 Apr 16 18:06 ..
>
> > -rw-r--r-- 1 andy andy 552 Apr 16 18:00 app_utils.py
>
> > -rw-r--r-- 1 andy andy 9286 Apr 16 18:00 function_class.py
>
> > -rw-r--r-- 1 andy andy 14460 Apr 16 18:00 gnucash_business.py
>
> > -rw-r--r-- 1 andy andy 272455 Apr 16 18:00 gnucash_core_c.py
>
> > -rwxr-xr-x 1 andy andy 1872240 Apr 16 18:00 _gnucash_core_c.so
>
> > -rw-r--r-- 1 andy andy 33878 Apr 16 18:00 gnucash_core.py
>
> > -rw-r--r-- 1 andy andy 443 Apr 16 18:00 __init__.py
>
> > drwxr-xr-x 2 andy andy 4096 Apr 16 18:00 __pycache__
>
> > -rw-r--r-- 1 andy andy 3772 Apr 16 17:58 sw_app_utils.py
>
> > -rwxr-xr-x 1 andy andy 163488 Apr 16 17:58 _sw_app_utils.so
>
> > -rw-r--r-- 1 andy andy 14200 Apr 16 17:59 sw_core_utils.py
>
> > -rwxr-xr-x 1 andy andy 196176 Apr 16 17:59 _sw_core_utils.so
>
> >
>
> > Sent: Sunday, April 19, 2020 at 10:43 AM
>
> > From: "Mark" <epistemik at gmail.com>
>
> > To: "gnucash-devel" <gnucash-devel at gnucash.org>
>
> > Subject: [GNC-dev] Fwd: Testing python
>
> > Forgot to reply all...
>
> > *Mark*
>
> > *epistemik at gmail.com <epistemik at gmail.com>*
>
> > *(613) 447-5385*
>
> > ---------- Forwarded message ---------
>
> > From: Mark <epistemik at gmail.com>
>
> > Date: Sun, Apr 19, 2020 at 11:42 AM
>
> > Subject: Re: [GNC-dev] Testing python
>
> > To: Andy Goblins <andygoblins at gmx.com>
>
> > From a terminal with your venv activated, can you show the actual
>
> > output
>
> > you get from a test like so:
>
> > (venv39) /newdata/dev/git/Python/VENV/venv39 | Sun Apr 19 11:16:23 |
>
> > marksa at Ares-A717-72G | bash 4.4.20
>
> > 2038 > python
>
> > Python 3.9.0a5+ (heads/master-dirty:3e0dd3730b, Apr 12 2020, 06:54:39)
>
> > [GCC 7.5.0] on linux
>
> > Type "help", "copyright", "credits" or "license" for more information.
>
> >
>
> > >>> import sys
>
> > >>> print(sys.path)
>
> >
>
> > ['', '/usr/local/lib/python39.zip', '/usr/local/lib/python3.9',
>
> > '/usr/local/lib/python3.9/lib-dynload',
>
> > '/newdata/dev/Python/VENV/venv39/lib/python3.9/site-packages',
>
> > '/home/marksa/.local/lib/python3.9/site-packages',
>
> > '/usr/local/lib/python3.9/site-packages']
>
> >
>
> > >>> import gnucash
>
> > >>> import gnucash.gnucash_core_c
>
> > >>> print(gnucash.gnucash_core_c.CREC)
>
> >
>
> > c
>
> >
>
> > >>> exit()
>
> >
>
> > This is the simple test I run to make sure I have properly set up a new
>
> > venv for running the gnucash python bindings. I presume you are getting
>
> > the
>
> > error messages as soon as you try to 'import gnucash'? As far as I can
>
> > tell, as long as you have the properly built bindings in one of the
>
> > site-packages or other directories in your sys.path, you should be able
>
> > to
>
> > run ok. So my venv 'lib/python3.9/site-packages' looks like this:
>
> > (venv39) /newdata/dev/git/Python/VENV/venv39 | Sun Apr 19 11:04:19 |
>
> > marksa at Ares-A717-72G | bash 4.4.20
>
> > 2010 > go lib/python3.9/site-packages/
>
> > total 12
>
> > drwxrwxr-x 2 marksa marksa 4096 Apr 15 09:12 PyQt5-stubs
>
> > drwxrwxr-x 2 marksa marksa 4096 Apr 15 09:12
>
> > PyQt5_stubs-5.14.2.0.dist-info
>
> > drwxrwxr-x 3 marksa marksa 4096 Apr 12 08:59 gnucash
>
> > (venv39)
>
> > /newdata/dev/git/Python/VENV/venv39/lib/python3.9/site-packages |
>
> > Sun Apr 19 11:04:27 | marksa at Ares-A717-72G | bash 4.4.20
>
> > 2011 > go gnucash/
>
> > total 14344
>
> > drwxrwxr-x 2 marksa marksa 4096 Apr 14 22:21 __pycache__
>
> > -rw-r--r-- 1 root root 5588952 Apr 12 08:59 _gnucash_core_c.so
>
> > -rw-r--r-- 1 root root 4345088 Apr 12 08:59 _sw_app_utils.so
>
> > -rw-r--r-- 1 root root 4364912 Apr 12 08:59 _sw_core_utils.so
>
> > -rw-r--r-- 1 root root 276305 Apr 12 08:58 gnucash_core_c.py
>
> > -rw-r--r-- 1 root root 552 Apr 11 12:28 app_utils.py
>
> > -rw-r--r-- 1 root root 9286 Apr 11 12:28 function_class.py
>
> > -rw-r--r-- 1 root root 33315 Apr 11 12:28 gnucash_core.py
>
> > -rw-r--r-- 1 root root 14460 Mar 29 14:50 gnucash_business.py
>
> > -rw-rw-r-- 1 marksa marksa 17808 Jan 12 16:57 sw_core_utils.py
>
> > -rw-rw-r-- 1 marksa marksa 4870 Jan 12 16:57 sw_app_utils.py
>
> > -rw-r--r-- 1 root root 443 Sep 14 2019 __init__.py
>
> > For me it doesn't look like you need an actual gnucash app installed in
>
> > the
>
> > venv to run the python bindings. But that I'm not sure about. If
>
> > everything
>
> > you have looks good and you are still getting the error messages then
>
> > you
>
> > may need some advice from someone who knows more about the way the
>
> > bindings
>
> > are actually accessing system libraries.
>
> > cheers,
>
> > *Mark*
>
> > *epistemik at gmail.com <epistemik at gmail.com>*
>
> > *(613) 447-5385*
>
> > On Sun, Apr 19, 2020 at 10:18 AM Andy Goblins <andygoblins at gmx.com>
>
> >
>
> > wrote:
>
> > > Since my python virtual environment is installed in the base of my
>
> >
>
> > build
>
> >
>
> > > directory, I assume it naturally has access to build/lib/gnucash and
>
> > > build/lib/python3.8/site-packages. This appears to be working
>
> >
>
> > partially; it
>
> >
>
> > > picks up the altered gnucash library in build/lib/python3.8 but it
>
> >
>
> > isn't
>
> >
>
> > > getting the C libraries in build/lib/gnucash.
>
> > >
>
> > > I also tried skipping the virtual environment and just running
>
> > > "GNC_UNINSTALLED=1;GNC_BUILDDIR=<my build
>
> >
>
> > dir>;PYTHONPATH=$GNC_BUILDDIR/lib/python3.8/site-packages:$GNC_BUILDDIR
>
> > /lib/gnucash
>
> >
>
> > > python" just like the cmake tests use, but I get the same result;
>
> >
>
> > it's not
>
> >
>
> > > finding the libgncmod-backend stuff in build/lib/gnucash.
>
> > >
>
> > > *Sent:* Saturday, April 18, 2020 at 12:47 PM
>
> > > *From:* "Mark" <epistemik at gmail.com>
>
> > > *To:* "andygoblins" <andygoblins at gmx.com>
>
> > > *Cc:* "GnuCash Developer" <gnucash-devel at gnucash.org>
>
> > > *Subject:* Re: [GNC-dev] Testing python
>
> > > I use the python bindings regularly but I've never got any warnings
>
> >
>
> > or
>
> >
>
> > > errors such as you describe. Just to cover the basics first, are you
>
> >
>
> > sure
>
> >
>
> > > you didn't want to issue the venv command with the
>
> >
>
> > '--system-site-packages'
>
> >
>
> > > switch? Did you have pygnucash loaded to the pip of the python you
>
> >
>
> > used for
>
> >
>
> > > venv? Or instead did you make sure that in your venv you have
>
> >
>
> > included the
>
> >
>
> > > path to your tinkered bindings in your PYTHONPATH? And you activated
>
> >
>
> > the
>
> >
>
> > > venv before using? Sorry if this is all basic stuff you already know
>
> >
>
> > about.
>
> >
>
> > > *Mark*
>
> > > *epistemik at gmail.com <epistemik at gmail.com>*
>
> > > *(613) 447-5385*
>
> > >
>
> > >
>
> > >
>
> > > On Sat, Apr 18, 2020 at 10:08 AM andygoblins <andygoblins at gmx.com>
>
> >
>
> > wrote:
>
> > >> I'm tinkering with the python bindings, but I'm having trouble
>
> >
>
> > testing
>
> >
>
> > >> the results of my changes. Could anyone give me some advice?
>
> > >> Currently, I build gnucash with ninja and then run 'python -m venv
>
> > >> <build dir>' to set up a virtual python environment right next to
>
> >
>
> > the
>
> >
>
> > >> fresh build. But when I try to import gnucash in the virtual
>
> > >> environment, it doesn't load any of the backends:
>
> > >> WARN <gnc.engine> failed to load gncmod-backend-dbi from relative
>
> >
>
> > path
>
> >
>
> > >> ERROR <gnc.engine> required library gncmod-backend-dbi not found.
>
> > >> WARN <gnc.engine> failed to load gncmod-backend-xml from relative
>
> >
>
> > path
>
> >
>
> > >> ERROR <gnc.engine> required library gncmod-backend-xml not found.
>
> > >> Any ideas on how to fix my path so I can load backends in my test
>
> > >> environment?
>
> > >> _______________________________________________
>
> > >> gnucash-devel mailing list
>
> > >> gnucash-devel at gnucash.org
>
> > >> [1]https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>
> >
>
> > _______________________________________________
>
> > gnucash-devel mailing list
>
> > gnucash-devel at gnucash.org
>
> > [2]https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>
> >
>
> > References
>
> >
>
> > 1. https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>
> > 2. https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>
> > _______________________________________________
>
> > gnucash-devel mailing list
>
> > gnucash-devel at gnucash.org
>
> > https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>
>
>
>
>


More information about the gnucash-devel mailing list