[GNC] How to bulk import about 130 Securities entries?

john jralls at ceridwen.us
Thu Aug 18 00:29:27 EDT 2022



> On Aug 16, 2022, at 8:18 PM, list+gnucash at jdlh.com wrote:
> 
> On 2022-08-16 19:54, john wrote:
> 
>> OTOH I'm pretty sure that gnc_commodity is fully exposed to the Python bindings so you should
>> be able to write a python script using them to do the same thing without voiding your warranty
>> or needing to unzip the file or, for that matter, caring which backend is used.
> 
> Ah! Thank you for this nudge, John. I like using Python. Doing my import via Python would likely be very comfortable for me.
> 
> This question may end up leading me to learn not just how to automate my mac UI, but also how to use the Python bindings in GnuCash.
> 
> I have been using the macOS GnuCash app downloaded via GnuCash.org, which I understand does not include Python bindings. However, I use MacPorts all the time, and it looks like MacPorts will be happy to provide me GnuCash with the Python bindings enabled.
> 
> I appreciate the pointer. (Well, not pointer exactly, because it is Python after all, but… reference?)
> 

Jim,

It's python wrapped around C, so you may well bump into pointers. ;-)

I don't include the python bindings in the macOS app bundle because every release of macOS has a different version of Python, and the bindings have to be linked against the same libpython as the interpreter. MacPorts custom builds everything on your machine so it's easier.

If you wanted you could also build GnuCash the way I do and include the python bindings. The instructions are at https://wiki.gnucash.org/wiki/MacOS/Quartz.

You didn't mention Homebrew, but I'm going to as a warning to others who might read this thread later: Homebrew's GnuCash is just a cask with my macOS bundle in it. It doesn't use any of the Homebrew infrastructure and so can't use the python bindings.

Regards,
John Ralls




More information about the gnucash-user mailing list