[GNC] Error importing QIF file

parag puranik parag_puranik at yahoo.com
Mon Oct 25 08:30:23 EDT 2021


 Thanks a lot for explaining the details. Let me try.
    On Monday, 25 October, 2021, 10:07:09 am IST, William Prescott <will at theprescotts.com> wrote:  
 
 File length        Number of splits to find a single record.
2            1
4            2
8            3
16            4
32            5
64            6
128            7
256            8
512            9
1024            10
etc

And in case it wasn't clear earlier in this conversation, the idea is you make a copy of the problem file, delete the first half of the records, see if the problem goes away, if not delete the second half and confirm that it is in the second half.
Then you take the half containing the problem, and repeat the process until you have it down to a single record that produces the problem.
If there are an odd number of records at any step, don't worry about it that the two halves are not exactly equal.

Will

On 2021 Oct 24, at 10-24 22:48:50, David H <hellvee at gmail.com> wrote:

Hello again parag puranik,

Please use reply-all to keep the discussion on the mailing list so everyone
is across everything.  I'm not a Gnucash developer or familiar with the
importers as I never use them and others that use them often can probably
offer more relevant suggestions :-)  See my responses/suggestions
highlighted in yellow below.

On Sun, 24 Oct 2021 at 23:24, parag puranik <parag_puranik at yahoo.com> wrote:

> I tried creating a new file in App, exported it in QIF format and
> successfully imported the same in Gnucash Desktop. Everything is fine in
> case of a fresh file export+import procedure.
> 

OK so it seems to definitely be an issue with your data then. How many
records are in your file anyway, I can't imagine it's in the hundreds if
you're using the android app to enter them?

Personally I would do the binary splits of the file as already suggested
making sure you don’t split a transaction in the middle. This shouldn't
take too long.  I think I read somewhere years ago that you only need a
maximum of 7 splits to find a target when using a binary search so this
should be similar.  My simplistic figures suggest a 200 record file would
require up to 9 splits in the worst case. So a maximum of split file /
import part file – say a couple of minutes each x 9 = about 18 - 20 minutes
should be enough to identify the record causing the problem and you may be
able to sort it out yourself once you've identified the problem record -
you would have had your answer by now :-)

Check out:

Gnucash QIF format document -
https://github.com/Gnucash/gnucash/blob/maint/gnucash/import-export/qif-imp/file-format.txt

and
<https://github.com/Gnucash/gnucash/blob/maint/gnucash/import-export/qif-imp/qif-file.scm>

Gnucash QIF Import code file -
<https://github.com/Gnucash/gnucash/blob/maint/gnucash/import-export/qif-imp/qif-file.scm>
https://github.com/Gnucash/gnucash/blob/maint/gnucash/import-export/qif-imp/qif-file.scm


I could be totally wrong but the error message seems come from line 974 in
the previous bit of code – according to the comment at line 921 it seems to
be checking for valid date formats (d-m-y, y-m-d, etc) and also that amount
fields are decimal (999.99) or comma format (999,99):-


My problem is only with my earlier file which I exported, but could not
> import in Desktop due to the Error message. I want to know the basis of the
> generation of that error message and get help in importing that file in
> desktop.
> 

I'm sure you do but you have to remember that this is a volunteer project /
development team who probably have other priorities and will take time to
get to your problem. Gnucash is a huge project with code in multiple
languages going back 20+ years and developers come and go so it would take
time to familiarise themselves with the code and work through it to
document it and give you a list of conditions as to exactly why a
particular error message is displayed.Their first response is likely to be
to tell you to check whether it’s an existing bug and if not to lodge a bug
report at Gnucash Bugzilla (https://bugs.gnucash.org).  They're also likely
to want to see your file as sometimes a quick scan through a file can
identify the issue. You've already had other suggestions re splitting your
file and importing in parts to identify the problem and this is probably
the fastest and most logical approach right now.

I suspect you have one or more hidden special characters in your file which
is causing a record to be split mid record and a misalignment in your file
hence the “Share Price” text in the error message. Seems the android app
has had some of these in the past where users have done a copy and paste
into a transaction on android.  These won’t be obvious in Notepad or
Wordpad as they don't display special characters so download either the
Textpad (https://www.textpad.com/download) or Notepad++ (
https://notepad-plus-plus.org/downloads/) text editor and use one of these
to inspect your file. You can turn on the display of special characters in
these editors – in Textpad click the icon to the left of the globe – looks
like a reverse “P” and in Notepad++ it’s the same icon.

I could not locate any trace file in Win10.
> I don't think the App compresses the file before exporting because when I
> open the QIF file in Text Editor-Windows Notepad, it opens successfully.
> The text editor surely doesn't decompress file before opening.
> 

No it won’t usually uncompress a file automatically – I was just going by
the bug report I read on the android app website so obviously irrelevant to
your issue.


> I just want the members / Gnucash Team to focus on the generated error
> message I posted in my first post and let me know in what circumstances
> this message gets generated and how to repair the QIF file so that I can
> import it into Desktop Gnucash.
> 


If you don't want to split your file and import partial files I would
suggest you do the following for starters:-

Read the file-format.txt text file mentioned above if you are unfamiliar
with the qif file format.

Check that each record begins on a new line and that each record has a CR
LF (easier to see in Notepad++) at the end of the record and not somewhere
in the middle thus splitting it mid-record.

Check Date fields for valid date format (d-m-y, y-m-d, etc) and valid date,
check amount fields for valid format amounts.

If you can identify the problem record, maybe there's more than one, and
you can't see why it would cause a problem then paste it into a message and
post it here so the experts can eyeball it and suggest a solution.


Cheers David H.


> On Sunday, 24 October, 2021, 04:18:44 pm IST, David H <hellvee at gmail.com>
> wrote:
> 
> 
> Hi parag puranik,
> 
> I was actually referring to the Gnucash trace file on your Win10 desktop
> as that is where you had the error and not on your Android device :-)  Also
> I did see an error report on Ngewi Fet's codinguser website to the effect
> that when you export qif from the android app it actually creates a
> compressed .zip file even though it has a .qif suffix -
> https://github.com/codinguser/gnucash-android/issues/889.  You are
> probably aware of this if you've used this process previously however.
> 
> Cheers David H.
> 
> On Sun, 24 Oct 2021 at 18:43, parag puranik via gnucash-user <
> gnucash-user at gnucash.org> wrote:
> 
> Thanks David H for your kind support. I'll upgrade to version 4.8 or so
> and try. OS:\ is Win10 for importing PC. Regarding log file/trace file :-
> After exporting from Android phone in QIF format, I carried out Factory
> reset operation on Android. So no trace file remaining on Android. That
> original Android app's file has been irretrievably lost for ever.
> 
> _______________________________________________
> 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.
> 
> 
_______________________________________________
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.

_______________________________________________
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-user mailing list