Hi,

I think you need to add a session.load() call in between creating the session 
and getting 
the root account.

There were other questions about this on the list. You may find more details 
searching the 
list history.

Regards,

Geert

Op zaterdag 7 december 2024 15:38:55 CET schreef Thomas Klausner:
> Hi!
> 
> I’m using Gnucash 5.9 on NetBSD with Python 3.13.1.
> I have a script that I run every half a year or so, and I ran it again
> today, and it didn’t work. The last time I ran it (successfully) was in
> April, so with Gnucash 5.6 and Python 3.12, I think.
> 
> The symptoms are that:
> - The root account has no children or descendants
> - Ending the session doesn’t remove the “.LCK” file.
> 
> I’ve simplified the script to the following:
> 
> 
> 
> #!/usr/bin/env python3
> 
>   import gnucash
> 
> 
>   session = gnucash.Session("test.gnucash")
>   root_account = session.book.get_root_account()
>   for child in root_account.get_children():
>       print(child.GetName())
>   for child in root_account.get_descendants():
>       print(child.GetName())
>   session.end()
> 
> 
> It should iterate over all accounts and print all of their names (once using
> get_children(), once using get_descendants()). I only tried
> get_descendants() because get_children() didn’t work.
> 
> Does this work for others (with Python 3.13?) or is this currently broken?
> 
> Any ideas what the problem could be or how to debug this?
> 
> Thanks,
>  Thomas
> 
> _______________________________________________
> 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.


_______________________________________________
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