[GNC-dev] Fwd: Testing python

Mark epistemik at gmail.com
Tue Apr 21 06:48:09 EDT 2020


Yes, all that looks fine. So, this is what my (venv)/lib and
(venv)/lib/gnucash look like:

(venv39) /newdata/dev/git/Python/VENV/venv39 | Tue Apr 21 06:25:08 |
marksa at Ares-A717-72G | bash 4.4.20
2058 > go lib
total 5780
drwxr-xr-x 3 root   root      4096 Apr 12 08:59 gnucash
-rw-r--r-- 1 root   root   1604600 Apr 12 08:58 libgnc-gnome.so
-rw-r--r-- 1 root   root   2803904 Apr 12 08:58 libgnc-backend-sql.so
-rw-r--r-- 1 root   root    906288 Apr 12 08:58 libgnc-backend-xml-utils.so
-rw-r--r-- 1 root   root    401432 Apr 12 08:58 libgnc-core-utils.so
-rw-r--r-- 1 root   root     42232 Apr 12 08:57 libgnc-module.so
-rw-r--r-- 1 root   root    138920 Apr 12 08:57 libgwengui-gtk3.so
drwxrwxr-x 3 marksa marksa    4096 Jan 12 16:56 python3.9
(venv39) /newdata/dev/git/Python/VENV/venv39/lib | Tue Apr 21 06:25:13 |
marksa at Ares-A717-72G | bash 4.4.20
2059 > go gnucash/
total 16020
-rw-r--r-- 1 root root 4270560 Apr 12 08:59 libgncmod-python.so
-rw-r--r-- 1 root root  192704 Apr 12 08:58 libgncmod-aqbanking.so
-rw-r--r-- 1 root root   70616 Apr 12 08:58 libgncmod-bi-import.so
-rw-r--r-- 1 root root   73128 Apr 12 08:58 libgncmod-csv-export.so
-rw-r--r-- 1 root root   51608 Apr 12 08:58 libgncmod-customer-import.so
-rw-r--r-- 1 root root  129720 Apr 12 08:58 libgncmod-qif-import.so
-rw-r--r-- 1 root root  331128 Apr 12 08:58 libgncmod-ledger-core.so
-rw-r--r-- 1 root root  219928 Apr 12 08:58 libgncmod-register-gnome.so
-rw-r--r-- 1 root root  184680 Apr 12 08:58 libgncmod-report-gnome.so
-rw-r--r-- 1 root root   14488 Apr 12 08:58 libgncmod-stylesheets.so
-rw-r--r-- 1 root root   12784 Apr 12 08:58 libgncmod-locale-reports-us.so
-rw-r--r-- 1 root root 2659616 Apr 12 08:58 libgncmod-csv-import.so
-rw-r--r-- 1 root root   97224 Apr 12 08:58 libgncmod-register-core.so
-rw-r--r-- 1 root root   35160 Apr 12 08:58 libgncmod-log-replay.so
-rw-r--r-- 1 root root   45456 Apr 12 08:58 libgncmod-ofx.so
-rw-r--r-- 1 root root  122856 Apr 12 08:58 libgncmod-generic-import.so
-rw-r--r-- 1 root root  141392 Apr 12 08:58 libgncmod-gnome-search.so
-rw-r--r-- 1 root root   96112 Apr 12 08:58 libgncmod-html.so
-rw-r--r-- 1 root root 1557184 Apr 12 08:58 libgncmod-gnome-utils.so
-rw-r--r-- 1 root root  608024 Apr 12 08:58 libgncmod-backend-dbi.so
-rw-r--r-- 1 root root   33560 Apr 12 08:58 libgncmod-backend-xml.so
-rw-r--r-- 1 root root   47856 Apr 12 08:58 libgncmod-report-system.so
-rw-r--r-- 1 root root  376136 Apr 12 08:58 libgncmod-app-utils.so
-rw-r--r-- 1 root root 4968024 Apr 12 08:58 libgncmod-engine.so
-rw-r--r-- 1 root root    8624 Apr 12 08:57 libgncmod-tax-us.so
drwxr-xr-x 3 root root    4096 Apr  2  2019 scm

If your folders look the same, hard to see what the problem could be...
Last thing I can suggest is to start your python with the -v switch and see
what it says about your 'import gnucash'. This is what I get:

(venv39) /newdata/dev/git/Python/VENV/venv39 | Tue Apr 21 06:27:51 |
marksa at Ares-A717-72G | bash 4.4.20

*2062 > python -v*import _frozen_importlib # frozen
import _imp # builtin
import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
import '_warnings' # <class '_frozen_importlib.BuiltinImporter'>
import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
import '_frozen_importlib_external' # <class
'_frozen_importlib.FrozenImporter'>
import 'posix' # <class '_frozen_importlib.BuiltinImporter'>
import '_io' # <class '_frozen_importlib.BuiltinImporter'>
import 'marshal' # <class '_frozen_importlib.BuiltinImporter'>
# installing zipimport hook
import 'time' # <class '_frozen_importlib.BuiltinImporter'>
import 'zipimport' # <class '_frozen_importlib.FrozenImporter'>
# installed zipimport hook
# /usr/local/lib/python3.9/encodings/__pycache__/__init__.cpython-39.pyc
matches /usr/local/lib/python3.9/encodings/__init__.py
# code object from
'/usr/local/lib/python3.9/encodings/__pycache__/__init__.cpython-39.pyc'
# /usr/local/lib/python3.9/__pycache__/codecs.cpython-39.pyc matches
/usr/local/lib/python3.9/codecs.py
# code object from
'/usr/local/lib/python3.9/__pycache__/codecs.cpython-39.pyc'
import '_codecs' # <class '_frozen_importlib.BuiltinImporter'>
import 'codecs' # <_frozen_importlib_external.SourceFileLoader object at
0x7f801596c370>
# /usr/local/lib/python3.9/encodings/__pycache__/aliases.cpython-39.pyc
matches /usr/local/lib/python3.9/encodings/aliases.py
# code object from
'/usr/local/lib/python3.9/encodings/__pycache__/aliases.cpython-39.pyc'
import 'encodings.aliases' # <_frozen_importlib_external.SourceFileLoader
object at 0x7f8015903910>
import 'encodings' # <_frozen_importlib_external.SourceFileLoader object at
0x7f801596c160>
# /usr/local/lib/python3.9/encodings/__pycache__/utf_8.cpython-39.pyc
matches /usr/local/lib/python3.9/encodings/utf_8.py
# code object from
'/usr/local/lib/python3.9/encodings/__pycache__/utf_8.cpython-39.pyc'
import 'encodings.utf_8' # <_frozen_importlib_external.SourceFileLoader
object at 0x7f801596cf40>
import '_signal' # <class '_frozen_importlib.BuiltinImporter'>
# /usr/local/lib/python3.9/encodings/__pycache__/latin_1.cpython-39.pyc
matches /usr/local/lib/python3.9/encodings/latin_1.py
# code object from
'/usr/local/lib/python3.9/encodings/__pycache__/latin_1.cpython-39.pyc'
import 'encodings.latin_1' # <_frozen_importlib_external.SourceFileLoader
object at 0x7f8015903a00>
# /usr/local/lib/python3.9/__pycache__/io.cpython-39.pyc matches
/usr/local/lib/python3.9/io.py
# code object from '/usr/local/lib/python3.9/__pycache__/io.cpython-39.pyc'
# /usr/local/lib/python3.9/__pycache__/abc.cpython-39.pyc matches
/usr/local/lib/python3.9/abc.py
# code object from '/usr/local/lib/python3.9/__pycache__/abc.cpython-39.pyc'
import '_abc' # <class '_frozen_importlib.BuiltinImporter'>
import 'abc' # <_frozen_importlib_external.SourceFileLoader object at
0x7f8015903eb0>
import 'io' # <_frozen_importlib_external.SourceFileLoader object at
0x7f8015903be0>
# /usr/local/lib/python3.9/__pycache__/site.cpython-39.pyc matches
/usr/local/lib/python3.9/site.py
# code object from
'/usr/local/lib/python3.9/__pycache__/site.cpython-39.pyc'
# /usr/local/lib/python3.9/__pycache__/os.cpython-39.pyc matches
/usr/local/lib/python3.9/os.py
# code object from '/usr/local/lib/python3.9/__pycache__/os.cpython-39.pyc'
# /usr/local/lib/python3.9/__pycache__/stat.cpython-39.pyc matches
/usr/local/lib/python3.9/stat.py
# code object from
'/usr/local/lib/python3.9/__pycache__/stat.cpython-39.pyc'
import '_stat' # <class '_frozen_importlib.BuiltinImporter'>
import 'stat' # <_frozen_importlib_external.SourceFileLoader object at
0x7f80158ba760>
# /usr/local/lib/python3.9/__pycache__/_collections_abc.cpython-39.pyc
matches /usr/local/lib/python3.9/_collections_abc.py
# code object from
'/usr/local/lib/python3.9/__pycache__/_collections_abc.cpython-39.pyc'
import '_collections_abc' # <_frozen_importlib_external.SourceFileLoader
object at 0x7f80158ba7f0>
# /usr/local/lib/python3.9/__pycache__/posixpath.cpython-39.pyc matches
/usr/local/lib/python3.9/posixpath.py
# code object from
'/usr/local/lib/python3.9/__pycache__/posixpath.cpython-39.pyc'
# /usr/local/lib/python3.9/__pycache__/genericpath.cpython-39.pyc matches
/usr/local/lib/python3.9/genericpath.py
# code object from
'/usr/local/lib/python3.9/__pycache__/genericpath.cpython-39.pyc'
import 'genericpath' # <_frozen_importlib_external.SourceFileLoader object
at 0x7f80158debb0>
import 'posixpath' # <_frozen_importlib_external.SourceFileLoader object at
0x7f80158ba880>
import 'os' # <_frozen_importlib_external.SourceFileLoader object at
0x7f801591ee50>
# /usr/local/lib/python3.9/__pycache__/_sitebuiltins.cpython-39.pyc matches
/usr/local/lib/python3.9/_sitebuiltins.py
# code object from
'/usr/local/lib/python3.9/__pycache__/_sitebuiltins.cpython-39.pyc'
import '_sitebuiltins' # <_frozen_importlib_external.SourceFileLoader
object at 0x7f8015930760>
# /usr/local/lib/python3.9/__pycache__/_bootlocale.cpython-39.pyc matches
/usr/local/lib/python3.9/_bootlocale.py
# code object from
'/usr/local/lib/python3.9/__pycache__/_bootlocale.cpython-39.pyc'
import '_locale' # <class '_frozen_importlib.BuiltinImporter'>
import '_bootlocale' # <_frozen_importlib_external.SourceFileLoader object
at 0x7f80158defa0>
# /usr/local/lib/python3.9/__pycache__/types.cpython-39.pyc matches
/usr/local/lib/python3.9/types.py
# code object from
'/usr/local/lib/python3.9/__pycache__/types.cpython-39.pyc'
import 'types' # <_frozen_importlib_external.SourceFileLoader object at
0x7f80158543d0>
# /usr/local/lib/python3.9/importlib/__pycache__/__init__.cpython-39.pyc
matches /usr/local/lib/python3.9/importlib/__init__.py
# code object from
'/usr/local/lib/python3.9/importlib/__pycache__/__init__.cpython-39.pyc'
# /usr/local/lib/python3.9/__pycache__/warnings.cpython-39.pyc matches
/usr/local/lib/python3.9/warnings.py
# code object from
'/usr/local/lib/python3.9/__pycache__/warnings.cpython-39.pyc'
import 'warnings' # <_frozen_importlib_external.SourceFileLoader object at
0x7f8015854f70>
import 'importlib' # <_frozen_importlib_external.SourceFileLoader object at
0x7f8015854c10>
# /usr/local/lib/python3.9/importlib/__pycache__/util.cpython-39.pyc
matches /usr/local/lib/python3.9/importlib/util.py
# code object from
'/usr/local/lib/python3.9/importlib/__pycache__/util.cpython-39.pyc'
# /usr/local/lib/python3.9/importlib/__pycache__/abc.cpython-39.pyc matches
/usr/local/lib/python3.9/importlib/abc.py
# code object from
'/usr/local/lib/python3.9/importlib/__pycache__/abc.cpython-39.pyc'
# /usr/local/lib/python3.9/importlib/__pycache__/machinery.cpython-39.pyc
matches /usr/local/lib/python3.9/importlib/machinery.py
# code object from
'/usr/local/lib/python3.9/importlib/__pycache__/machinery.cpython-39.pyc'
import 'importlib.machinery' # <_frozen_importlib_external.SourceFileLoader
object at 0x7f8015878820>
import 'importlib.abc' # <_frozen_importlib_external.SourceFileLoader
object at 0x7f801586cb20>
# /usr/local/lib/python3.9/__pycache__/contextlib.cpython-39.pyc matches
/usr/local/lib/python3.9/contextlib.py
# code object from
'/usr/local/lib/python3.9/__pycache__/contextlib.cpython-39.pyc'
# /usr/local/lib/python3.9/collections/__pycache__/__init__.cpython-39.pyc
matches /usr/local/lib/python3.9/collections/__init__.py
# code object from
'/usr/local/lib/python3.9/collections/__pycache__/__init__.cpython-39.pyc'
# /usr/local/lib/python3.9/__pycache__/operator.cpython-39.pyc matches
/usr/local/lib/python3.9/operator.py
# code object from
'/usr/local/lib/python3.9/__pycache__/operator.cpython-39.pyc'
import '_operator' # <class '_frozen_importlib.BuiltinImporter'>
import 'operator' # <_frozen_importlib_external.SourceFileLoader object at
0x7f8012034d30>
# /usr/local/lib/python3.9/__pycache__/keyword.cpython-39.pyc matches
/usr/local/lib/python3.9/keyword.py
# code object from
'/usr/local/lib/python3.9/__pycache__/keyword.cpython-39.pyc'
import 'keyword' # <_frozen_importlib_external.SourceFileLoader object at
0x7f8012034e20>
# /usr/local/lib/python3.9/__pycache__/heapq.cpython-39.pyc matches
/usr/local/lib/python3.9/heapq.py
# code object from
'/usr/local/lib/python3.9/__pycache__/heapq.cpython-39.pyc'
# extension module '_heapq' loaded from
'/usr/local/lib/python3.9/lib-dynload/_heapq.cpython-39-x86_64-linux-gnu.so'
# extension module '_heapq' executed from
'/usr/local/lib/python3.9/lib-dynload/_heapq.cpython-39-x86_64-linux-gnu.so'
import '_heapq' # <_frozen_importlib_external.ExtensionFileLoader object at
0x7f801203d550>
import 'heapq' # <_frozen_importlib_external.SourceFileLoader object at
0x7f8012034fa0>
import 'itertools' # <class '_frozen_importlib.BuiltinImporter'>
# /usr/local/lib/python3.9/__pycache__/reprlib.cpython-39.pyc matches
/usr/local/lib/python3.9/reprlib.py
# code object from
'/usr/local/lib/python3.9/__pycache__/reprlib.cpython-39.pyc'
import 'reprlib' # <_frozen_importlib_external.SourceFileLoader object at
0x7f8012034f10>
import '_collections' # <class '_frozen_importlib.BuiltinImporter'>
import 'collections' # <_frozen_importlib_external.SourceFileLoader object
at 0x7f801588bd60>
# /usr/local/lib/python3.9/__pycache__/functools.cpython-39.pyc matches
/usr/local/lib/python3.9/functools.py
# code object from
'/usr/local/lib/python3.9/__pycache__/functools.cpython-39.pyc'
import '_functools' # <class '_frozen_importlib.BuiltinImporter'>
import 'functools' # <_frozen_importlib_external.SourceFileLoader object at
0x7f801588bf10>
import 'contextlib' # <_frozen_importlib_external.SourceFileLoader object
at 0x7f801586cd30>
import 'importlib.util' # <_frozen_importlib_external.SourceFileLoader
object at 0x7f8015854df0>
# possible namespace for /usr/local/lib/python3.9/site-packages/google
import 'site' # <_frozen_importlib_external.SourceFileLoader object at
0x7f8015903ee0>
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.
# extension module 'readline' loaded from
'/usr/local/lib/python3.9/lib-dynload/
readline.cpython-39-x86_64-linux-gnu.so'
# extension module 'readline' executed from
'/usr/local/lib/python3.9/lib-dynload/
readline.cpython-39-x86_64-linux-gnu.so'
import 'readline' # <_frozen_importlib_external.ExtensionFileLoader object
at 0x7f8015878fd0>
import 'atexit' # <class '_frozen_importlib.BuiltinImporter'>
# /usr/local/lib/python3.9/__pycache__/rlcompleter.cpython-39.pyc matches
/usr/local/lib/python3.9/rlcompleter.py
# code object from
'/usr/local/lib/python3.9/__pycache__/rlcompleter.cpython-39.pyc'
import 'rlcompleter' # <_frozen_importlib_external.SourceFileLoader object
at 0x7f8012041a60>


*>>> 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*#
/newdata/dev/Python/VENV/venv39/lib/python3.9/site-packages/gnucash/__pycache__/__init__.cpython-39.pyc
matches
/newdata/dev/Python/VENV/venv39/lib/python3.9/site-packages/gnucash/__init__.py
# code object from
'/newdata/dev/Python/VENV/venv39/lib/python3.9/site-packages/gnucash/__pycache__/__init__.cpython-39.pyc'
#
/newdata/dev/Python/VENV/venv39/lib/python3.9/site-packages/gnucash/__pycache__/gnucash_core.cpython-39.pyc
matches
/newdata/dev/Python/VENV/venv39/lib/python3.9/site-packages/gnucash/gnucash_core.py
# code object from
'/newdata/dev/Python/VENV/venv39/lib/python3.9/site-packages/gnucash/__pycache__/gnucash_core.cpython-39.pyc'
#
/newdata/dev/Python/VENV/venv39/lib/python3.9/site-packages/gnucash/__pycache__/gnucash_core_c.cpython-39.pyc
matches
/newdata/dev/Python/VENV/venv39/lib/python3.9/site-packages/gnucash/gnucash_core_c.py
# code object from
'/newdata/dev/Python/VENV/venv39/lib/python3.9/site-packages/gnucash/__pycache__/gnucash_core_c.cpython-39.pyc'
# extension module 'gnucash._gnucash_core_c' loaded from
'/newdata/dev/Python/VENV/venv39/lib/python3.9/site-packages/gnucash/_gnucash_core_c.so'
# extension module 'gnucash._gnucash_core_c' executed from
'/newdata/dev/Python/VENV/venv39/lib/python3.9/site-packages/gnucash/_gnucash_core_c.so'
import 'gnucash._gnucash_core_c' #
<_frozen_importlib_external.ExtensionFileLoader object at 0x7f801167b310>
import 'gnucash.gnucash_core_c' #
<_frozen_importlib_external.SourceFileLoader object at 0x7f8011df9a30>
#
/newdata/dev/Python/VENV/venv39/lib/python3.9/site-packages/gnucash/__pycache__/function_class.cpython-39.pyc
matches
/newdata/dev/Python/VENV/venv39/lib/python3.9/site-packages/gnucash/function_class.py
# code object from
'/newdata/dev/Python/VENV/venv39/lib/python3.9/site-packages/gnucash/__pycache__/function_class.cpython-39.pyc'
import 'gnucash.function_class' #
<_frozen_importlib_external.SourceFileLoader object at 0x7f801167b520>
import 'gnucash.gnucash_core' #
<_frozen_importlib_external.SourceFileLoader object at 0x7f8012047cd0>
import 'gnucash' # <_frozen_importlib_external.SourceFileLoader object at
0x7f8012047ac0>


*>>> import gnucash.gnucash_core_c>>> print(gnucash.gnucash_core_c.CREC)*c


Gives a hell of a lot of output, but hopefully the difference in the output
of my 'import gnucash' and yours can tell you how your venv is different.


cheers,

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



On Mon, Apr 20, 2020 at 11:15 PM Andy Goblins <andygoblins at gmx.com> wrote:

> 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
> >> 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