Am 2023-11-20 06:23, schrieb john:
On Nov 19, 2023, at 10:23, Manfred Usselmann <manf...@usselmann.de>
wrote:
Am 2023-11-19 18:26, schrieb john:
On Nov 19, 2023, at 08:02, Manfred Usselmann <manf...@usselmann.de>
wrote:
Am 2023-11-18 20:32, schrieb john:
On Nov 17, 2023, at 17:23, Manfred Usselmann <manf...@usselmann.de>
wrote:
Am 2023-11-17 05:58, schrieb john:
On Nov 16, 2023, at 14:25, Manfred Usselmann <manf...@usselmann.de>
wrote:
Am 2023-11-16 18:41, schrieb john:
On Nov 16, 2023, at 03:50, Manfred Usselmann <manf...@usselmann.de>
wrote:
Hi,
Am 2023-11-07 04:53, schrieb john:
On Nov 6, 2023, at 16:12, Manfred Usselmann <manf...@usselmann.de>
wrote:
Hi John,
Am 2023-11-06 19:31, schrieb john:
On Nov 6, 2023, at 05:11, Manfred Usselmann <manf...@usselmann.de>
wrote:
Hi,
Am 2023-10-01 17:47, schrieb john:
On Oct 1, 2023, at 06:00, Derek Atkins <de...@ihtfp.com> wrote:
On Sun, October 1, 2023 12:00 am, flywire wrote:
https://lists.gnucash.org/pipermail/gnucash-user/2023-April/106619.html
John wrote:
we don't have a Windows CI action, the nightly builds are done with the
https://github.com/gnucash/GnuCash-on-windows powershell scripts on a
Windows VM in Derek's basement.
The nightly builds are those on
https://code.gnucash.org/builds/win32/stable/, right?
Would it be possible to additonally provide a version there which
includes the Python bindings? No, there's no way to make that work with
an installed package.
Since there already exists a working build environment, I would hope
that it's not too much work?
That depends on what you want to use for your Python. If you can use
the MSYS2 environment from Powershell (some MSYS2 things work directly
in Powershell, others need a Bash shell) then you can simply add
-DWITH_PYTHON=ON to the CMakeArgs in jhbuild and build it. Don't run the
installer, just add
c:\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages to
PYTHONPATH and run your scripts.
After starting from scratch I'm now able to run a successful build
including the Python bindings.
After adding
C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages
to PYTHONPATH my script now starts and does no longer complain about the
gnucash imports.
But the script aborts and it looks like Python does not find
_gnucash_core_c.dll in this folder. :-(
I also added
C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash
to the Windows Path, but this does not help.
Traceback (most recent call last):
File
"C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\gnucash_core_c.py",
line 14, in swig_import_helper
return importlib.import_module(mname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"C:\Users\mu\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py",
line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
File "<frozen importlib._bootstrap>", line 1318, in
_find_and_load_unlocked
ModuleNotFoundError: No module named 'gnucash._gnucash_core_c'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\mu\Documents\Nextcloud_Manfred\Manfred
Entwicklung\USS\Projects\GCToolbox\GCImport\gcimport.py", line 18, in
<module>
from gnucash import Session, Account, Transaction, Split,
GncNumeric, GUID, GUIDString, gnucash_core_c
File
"C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\__init__.py",
line 6, in <module>
from gnucash.gnucash_core import *
File
"C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\gnucash_core.py",
line 36, in <module>
from gnucash import gnucash_core_c
File
"C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\gnucash_core_c.py",
line 17, in <module>
_gnucash_core_c = swig_import_helper()
^^^^^^^^^^^^^^^^^^^^
File
"C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\gnucash_core_c.py",
line 16, in swig_import_helper
return importlib.import_module('_gnucash_core_c')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"C:\Users\mu\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py",
line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_gnucash_core_c'
Process finished with exit code 1
Do you also have
C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib and
C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\gnucash
in %PATH% ?
I've added them now, but it makes no difference.
Does
C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\_gnucash_core_c.dll
exist?
BTW the bindings also need _sw_app_utils.dll and _sw_core_utils.dll in
that directory along with _gnucash_core_c.dll and various python files.
Yes, they are there the following files:
__init__.py
_gnucash_core_c.dll
_sw_app_utils.dll
_sw_core_utils.dll
app_utils.py
deprecation.py
function_class.py
gnucash_business.py
gnucash_core.py
gnucash_core_c.py
folder __pycache__
Some of these files are mentioned in the error messages above.
Could it be a problem for importlib.import_module() that GnuCash is
build with Python 3.11 32-bit and I have Python 3.11 64-bit installed?
Ah, missed that. It's not even 3.11:
File
"C:\Users\mu\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py",
line 90, in import_module
That wouldn't work even if it was a 32-bit build because it's a
different version of python and the cpython folks don't maintain ABI
across versions. For best results use
C:\Users\mu\Entwicklung\GnuCash\gcdev64\msys2\mingw32\bin\python3,
making sure to set up the environment accordingly. The easiest way to do
that is to use the Mingw32 shell from Start>MSYS2.
Regards,
John Ralls
This error occurs even then:
Traceback (most recent call last):
File
"C:/Users/mu/Entwicklung/GnuCash/gcdev64/gnucash/stable/inst/lib/python3.11/site-packages/gnucash/gnucash_core_c.py",
line 14, in swig_import_helper
return importlib.import_module(mname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"C:/Users/mu/Entwicklung/GnuCash/gcdev64/msys2/mingw32/lib/python3.11/importlib/__init__.py",
line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1140, in
_find_and_load_unlocked
ModuleNotFoundError: No module named 'gnucash._gnucash_core_c'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\mu\Documents\Nextcloud_Manfred\Manfred
Entwicklung\USS\Projects\GCToolbox\GCImport\gcimport.py", line 17, in
<module>
from gnucash import Session, Account, Transaction, Split,
GncNumeric, GUID, GUIDString, gnucash_core_c
File
"C:/Users/mu/Entwicklung/GnuCash/gcdev64/gnucash/stable/inst/lib/python3.11/site-packages/gnucash/__init__.py",
line 6, in <module>
from gnucash.gnucash_core import *
File
"C:/Users/mu/Entwicklung/GnuCash/gcdev64/gnucash/stable/inst/lib/python3.11/site-packages/gnucash/gnucash_core.py",
line 36, in <module>
from gnucash import gnucash_core_c
File
"C:/Users/mu/Entwicklung/GnuCash/gcdev64/gnucash/stable/inst/lib/python3.11/site-packages/gnucash/gnucash_core_c.py",
line 17, in <module>
_gnucash_core_c = swig_import_helper()
^^^^^^^^^^^^^^^^^^^^
File
"C:/Users/mu/Entwicklung/GnuCash/gcdev64/gnucash/stable/inst/lib/python3.11/site-packages/gnucash/gnucash_core_c.py",
line 16, in swig_import_he
lper
return importlib.import_module('_gnucash_core_c')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"C:/Users/mu/Entwicklung/GnuCash/gcdev64/msys2/mingw32/lib/python3.11/importlib/__init__.py",
line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_gnucash_core_c'
What else can I try? What's the shebang in
C:\Users\mu\Documents\Nextcloud_Manfred\Manfred
Entwicklung\USS\Projects\GCToolbox\GCImport\gcimport.py?
# -*- coding: utf-8 -*-
That's not a shebang, it's a comment for your editor to set the
encoding. The shebang starts with #! (the exclamation point is
traditionally called a "bang" by unix users) followed by a command (it
should be something like `python`, `/path/to/python` or `/usr/bin/env
python` or one of the same ending in `python3`) that tells the shell
(the "she" part of "shebang") what program to feed the file to. It's
necessary to use a text file like a python script as an executable as
the error stack trace indicates that you did.
The file doesn't contain a shebang then.
I execute it with python and the script as parameter.
What do `which python` and `which python3` display? (Should be the same
thing.)
$ `which python`
Python 3.11.6 (main, Nov 8 2023, 19:14:30) [GCC 13.2.0 32 bit] on
win32
$ `which python3`
Python 3.11.6 (main, Nov 8 2023, 19:14:30) [GCC 13.2.0 32 bit] on
win32
That's odd. `which` is supposed to return a path, not invoke the
command's version option. See e.g. https://linux.die.net/man/1/which.
Maybe it's because you included the back-ticks. Try again without them.
Yes, I did.
$ which python
/mingw32/bin/python
$ which python3
/mingw32/bin/python3
$ ls -la /mingw32/bin/python*
-rwxr-xr-x 1 Manfred Manfred 3765 Nov 8 20:14
/mingw32/bin/python-config
-rwxr-xr-x 1 Manfred Manfred 99088 Nov 8 20:14 /mingw32/bin/python.exe
-rwxr-xr-x 1 Manfred Manfred 3765 Nov 8 20:14
/mingw32/bin/python3-config
-rwxr-xr-x 1 Manfred Manfred 3765 Nov 8 20:14
/mingw32/bin/python3.11-config
-rwxr-xr-x 1 Manfred Manfred 99088 Nov 8 20:14
/mingw32/bin/python3.11.exe
-rwxr-xr-x 1 Manfred Manfred 99088 Nov 8 20:14 /mingw32/bin/python3.exe
-rwxr-xr-x 1 Manfred Manfred 97552 Nov 8 20:14
/mingw32/bin/python3w.exe
-rwxr-xr-x 1 Manfred Manfred 97552 Nov 8 20:14 /mingw32/bin/pythonw.exe
All as it should be, so I'm stumped.
I tried to debug it a bit and noticed that the import is not searching
for files with extension .dll, but only .py, pyw, pyd, pyc, etc.
Therefore I renamed the three DLLs in
C:/Users/mu/Entwicklung/GnuCash/gcdev64/gnucash/stable/inst/lib/python3.11/site-packages/gnucash/
from *.dll to *.pyd.
Now the pyd ist found and I get another error message:
Traceback (most recent call last):
File
"C:\Users\mu\Entwicklung\GnuCash\gcdev64\gnucash\stable\inst\lib\python3.11\site-packages\gnucash\gnucash_core_c.py",
line 14, in swig_import_helper
return importlib.import_module(mname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"C:\Users\mu\Entwicklung\GnuCash\gcdev64\msys2\mingw32\lib\python3.11\importlib\__init__.py",
line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 676, in _load_unlocked
File "<frozen importlib._bootstrap>", line 573, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 1237, in
create_module
File "<frozen importlib._bootstrap>", line 241, in
_call_with_frames_removed
ImportError: DLL load failed while importing _gnucash_core_c: Das
angegebene Modul wurde nicht gefunden. (The specified module could not
be found)
Then I used a dependency checker to find out, which DLLs are needed by
_gnucash_core_c:
libglib-2.0-0.dll
libgobject-2.0-0.dll
libintl-8.dll
libpython3.11.dll
libxml2-2.dll
libgnc-app-utils.dll
libgnc-core-utils.dll
libgnc-engine.dll
and some windows DLLs.
I've added the corresponding folders to PATH and PYTHONPATH, but still
this error remains...
Regards,
Manfred
_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel