Hi Jim,

Did you succeed to import the Python bindings with  `import gnucash`?
> That has succeeded sometimes, and failed sometimes, but presently it
> succeeds.


Could this happen because the book was sometimes locked ? (just a question)

Thanks for the code bits. You helped me in the way that it made clear that
gnucash bindings work with Python 3.11. So I decided to give it a try.

As I said, I have Ubuntu 22.04 on my system. This did not seem old to me,
but it is ~2 years old, and the last LTS version is 24.04. That comes with
Python 3.12 and packaged with GnuCash 5.5. I tried those and voila: *it
worked*!

For those interested, I did not upgrade my system (yet). I used an app
called `distrobox`, which allowed me to use the other distribution inside
the terminal, and to run the graphical version of GnuCash as well (it is
kind of a docker container, but more tightly integrated with the host).
Cool stuff! I also succeeded in doing transactions with Python.

So thank you for all your help. I am happy now :)

Cheers,
     Zsolt

On Wed, 14 Aug 2024 at 02:16, Jim DeLaHunt <list+gnuc...@jdlh.com> wrote:

>
> On 2024-08-13 15:14, Gere Kiss Zsolt wrote:
>
> Hi Jim,
>
> and thanks for the response.
>
> > I too am someone who has used GnuCash from the UI from several years,
> and is now starting to try using the Python bindings. I am on macOS
> rather than Linux.
>
> Did you succeed to import the Python bindings with  `import gnucash`?
>
> That has succeeded sometimes, and failed sometimes, but presently it
> succeeds. (Using the MacPorts distribution of gnucash @5.8_1+docs on macOS.)
>
> I can also, for example, add a security to a book file by using the
> GncCommodity() class. This sample code worked for me:
>
> >>> import gnucash
> >>> FILE = "file://./test_book_1.gnucash"
> >>> session = gnucash.gnucash_core.Session(FILE)
> >>> book = session.book
> >>> comms = book.get_table()
> >>> qqq = gnucash.gnucash_core.GncCommodity(book, 'QQQ_fullname', 
> >>> 'MySecurityType', 'QQQ', 'QQQ_qsip', 100)
> >>> comms.insert(qqq)
> >>> session.end()
> >>> session.destroy()
> >>> quit()
>
>
> >  Suggestion 1: is the OS package python3-gnucash installed on your
> system?
>
> Sure, as I mentioned:
>
> Other gnucash related OS packages:
>>
>>    - gnucash-common
>>    - gnucash-docs
>>    - *python3-gnucash*
>>
>> Sorry, I guess I did not follow your meaning. I read you as saying that
> those packages, but not that those packages were actually installed on your
> system.
>
>
> > Suggestion 2: what info about python3-gnucash does the apt system
> display (in the same way it displayed information about the package
> gnucash)?
>
> Package: python3-gnucash
> Version: 1:4.8-1build2
> State: installed
> Section: universe/python
> Maintainer: Ubuntu Developers <ubuntu-devel-disc...@lists.ubuntu.com>
> Architecture: amd64
> Depends: libc6 (>= 2.14), libglib2.0-0 (>= 2.12.0), libpython3.10 (>=
> 3.10.0), python3 (< 3.11), python3 (>= 3.10~), python3:any
>
> As you can see from Depends, it installs bindings for python3 >= 3.10~ <
> 3.11.
> 3.10.12 is the version of Python3 installed on my OS, so this should
> conform (no wonder, since it is an OS package). Maybe some other libraries
> (like libc6?, etc.) are incompatible between gnucash and python3-gnucash?
>
> You have reached the limit of my knowledge, especially concerning GnuCash
> on Linux. Sorry.
>
> Can you do `import gnucash` from a Python REPL?
>
> Again, yes.  Thus you can be confident that it has worked for someone
> somewhere at some time.
>
> Best regards,
>      —Jim DeLaHunt
>


-- 
Üdvözlettel,

   Zsolt

---------------------------------------------------------------------------------------------------
„We have two lives, and the second begins when we realize we only have one.”
-- Confucius
_______________________________________________
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.

Reply via email to