GnuCash import difficulty and interim solution

Thomas Baumgart thb at net-bembel.de
Sat Jan 6 21:39:21 GMT 2024


On Samstag, 6. Januar 2024 18:24:47 CET Jack via KMyMoney-devel wrote:

> On 1/6/24 12:17, Jonathan Kimmitt wrote:
> > Yes, it is present and has version GNC Importer Version 5.1.3-33a66be8a. Under OSX it’s in KMyMoney preferences instead of Setting
> >
> > It’s probably something stupid like an account or payee name with an & in is represented unadorned in the XML whereas KMyMoney requires &
> That is certainly possible, but I'll have to look into the code to see 
> what exactly triggers that particular error message.  If you are right, 
> then we would want to find a utility that checks XML files for proper 
> encoding/markup (I can't think of the exact term right now.)

Encoding and structure are the two important things. xmllint would be the tool to use.

I scanned the GNC plugin's open() call real quick. Here is what it checks:

- file is not a database (e.g. SQL, SQLite, ...)
- file is on local drive (url starts with file://)
- file is readable
- if file is gzip compressed (first two bytes are "\037\213") it re-opens it
  for decompression
- first bytes in file are not "SQ"
- the first 70 bytes of the file must contain the regex "<gnc-v(\\d+)"

In case all that is true, a dialog is shown. This contains a switch
to turn on debug messages which are printed to the console (in case
KMyMoney was started via terminal) while the file is parsed. Now I have
two questions: Does the dialog is shown? Do these debug messages provide
any hint or details why the import fails?

Thomas




> >> On 6 Jan 2024, at 17:10, Jack via KMyMoney-devel <kmymoney-devel at kde.org> wrote:
> >>
> >> On 1/6/24 11:40, Jonathan Kimmitt via KMyMoney-devel wrote:
> >>> Hi Jack,
> >>>    I am using Apple M1 macOS 14.2.1 (23C71), with GnuCash Version: 5.4 Build ID: 5.4+(2023-09-23) and KMyMoney Version 5.1.3-33a66be8a
> >>>
> >>> The converter was written with OCaml 5.0.0 but I would not expect any lack of portability for the XML handling.
> >>>
> >>> The error when trying to open the GnuCash XML  in the GUI was:
> >>> Could not read your data source. Please check the KMyMoney settings that the necessary plugin is enabled.
> >>>
> >>> Based on what Mark was saying, it sounds like the failure is something quite trivial, however I lack the knowledge to debug it.
> >>>
> >>> Regards,
> >>> Jonathan
> >> I'll have to do some digging, but the first step would be to assure the file can be read.  If it is on a local drive and you can look at it in a text editor, then that's OK.  The next step would be to assure that the guncash importer is present and enabled.  Go to Setting/Configure KMyMoney... select Plugins on the left side, and see if GNC Importer is present on the right.  If it's there, then we do have an interesting problem.  If it is NOT present, then we need to figure out why not.  I just confirmed it IS present in the Appimage versions, but I don't know about the macOS version.
> 
> 

-- 

Regards

Thomas Baumgart

-------------------------------------------------------------
Ilde servers are the devil's work -- robbyoconnor on #irc
-------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 868 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20240106/1402fa1d/attachment.sig>


More information about the KMyMoney-devel mailing list