[GNC-dev] Fwd: Testing python
Mark
epistemik at gmail.com
Sun Apr 19 11:43:36 EDT 2020
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
>> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>
>
More information about the gnucash-devel
mailing list