[GNC-dev] [GNC] QIF file import failed -- but no errors or warnings
James Peterson
lyle at austin.rr.com
Wed Feb 19 17:14:52 EST 2020
I looked at the trace file being produced in /tmp/gnucash.trace,
but it did not seem to help any.
I added (gnc:pk ...) messages, but none of them ever
appeared.
I added (pk ...) lines to qif-to-gnc.scm to try to trace
what it was doing. This produced a large amount of output
on the terminal, but since I am no longer using an KSR-33
for output, it just whizzed by.
The first failure seemed to be after the listing of all the
accounts, when it suddenly says "!Option:AutoSwitch" in the
QIF file, but I think that was a red herring -- after I deleted
the line and then put it back, it proceeded past that point.
It seems to be failing on each split transaction. For example,
my first failure is at:
D10/ 2' 1
U-600.00
T-600.00
PCash
S
$0.00
SCharity
EPlanned Parenthood
$-500.00
SCharity
EKUT
$-100.00
^
which should be a cash transaction, from my checking account, for
a total of $600 split into $500 to Planned Parenthood and $100 to KUT.
It seems to dislike the line with just an S on it.
Looking at the transaction in Quicken, it is a split transaction as
described, but the $500 is on line 2, the $100 on line 3 -- line 1 of
the split is empty, possibly as a result of editting -- there used to
be something on line 1, but for some reason it was deleted.
In my QIF code, there is a reference to a Quicken help file that says:
S: Category in split
E: Memo in split
$: Dollar amount of split
so this would seem to be a missing category.
For a missing category with an amount of $0.00, we could obviously ignore
both that part of the split. But my next problem is a transaction like:
D6/ 5' 4
U-1,238.00
T-1,238.00
N967
PState Farm
S
$-1,238.00
S[Linda's Account]
$-412.00
SCarrying Costs
$412.00
^
where there is an uncategorized expense of $1238. I think what happened
there is it was originally completely defined, with a category, as a
non-split, and then I came back and split it (my live-in girlfriend pays
1/3 of all housing costs over $500), and Quicken apparently did not carry
the previously defined category into the new split.
Using emacs on the QIF file, to find all lines with just an S,
I went back into Quicken found all the transactions with splits and no
category and editted them to fix the problem, then exported a new QIF
file.
And gnucash now loads all transactions, without failure.
Not right, mind you, but it loads everything. I end up with a
negative 2 million dollar net worth, but that's a whole different
problem.
The most helpful thing to do was to put
(pk "convert transaction" xtn)
into the qif-to-gnc.scm file at about here:
(for-each
(lambda (xtn)
;; Update the progress.
(update-progress)
(pk "convert transaction" xtn)
(if (not (qif-xtn:mark xtn))
;; Convert into a GnuCash transaction.
that line prints each transaction just before it tries to convert
it, so when it fails, the last transaction printed is what caused
the failure. I can't tell what all the fields of the printed
transaction are but a few, like the date, the amount, the payee
or the accounts are enough to help me find it in the QIF file.
Maybe have a way for the --debug --extra flags to put this into
the trace file? And then tell people who have QIF loading problems
to run it with --debug --extra and look at the trace file.
jim
On Wed, 2020-02-19 at 15:31 +0000, Christopher Lam wrote:
> Moved to devel because this is developer stuff. It's difficult because the
> programming was done 20 years ago when toolkits were much more primitive.
> You have two options to log.
>
> in C, add PWARN ("retval is %s", retval? "True" : "False"); in assistant-
> qif-import.c:3050
> in guile, add (gnc:pk "objects1 = " object1 " object2=" object2) in qif-to-
> gnc.scm
>
> On Tue, 18 Feb 2020 at 17:44, crazylyle <lyle at austin.rr.com> wrote:
> > I downloaded the current source code and built it.
> >
> > After gnucash tries to import my QIF file, I get the single word
> > "Failed".
> > Tracking
> > this down, it is coming from
> >
> > /* Inform the user. */
> > gnc_progress_dialog_set_sub (wind->convert_progress, _("Failed"));
> >
> > in assistant-qif-import.c at about line 3105, and is a result of
> >
> > if (scm_is_symbol (retval)) at line 3093 before that. The scm_is_symbol
> > seems to be a scheme function that determines if the retval is a scheme
> > symbol.
> >
> > The retval is set by calling scm_apply (qif_to_gnc, ...) at about line
> > 3040,
> > which then takes us to the Scheme function qif-import:qif-to-gnc in
> > qif-to-gnc.scm. which seems to be about 200 lines of Scheme code
> > which is probably catching an exception but generates no error messages
> > or hint as to what is wrong.
> >
> > What with the large level of complexity in building gnucash using cmake,
> > scheme, swig, and c,
> > and the resulting dynamic loading of libraries,
> > it's difficult for an outsider to step in and try to help.
> >
> >
> >
> >
> >
> > --
> > Sent from: http://gnucash.1415818.n4.nabble.com/GnuCash-User-f1415819.html
> > _______________________________________________
> > gnucash-user mailing list
> > gnucash-user at gnucash.org
> > To update your subscription preferences or to unsubscribe:
> > https://lists.gnucash.org/mailman/listinfo/gnucash-user
> > If you are using Nabble or Gmane, please see
> > https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
> > -----
> > Please remember to CC this list on all your replies.
> > You can do this by using Reply-To-List or Reply-All.
More information about the gnucash-devel
mailing list