GnuCash
Contact   Instructions
Bug 796992 - gnucash --add-price-quotes can't parse drive letters on Windows.
Summary: gnucash --add-price-quotes can't parse drive letters on Windows.
Status: NEW
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Import - Other (show other bugs)
Version: 3.3
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Geert Janssens
QA Contact: import
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-27 20:44 EST by Len Merkel
Modified: 2019-07-09 14:47 EDT (History)
6 users (show)

See Also:


Attachments
Trace file as requested (44 bytes, text/plain)
2018-12-28 14:59 EST, Len Merkel
no flags Details
--debug --extra --add-price-quotes XML data (28.37 KB, text/plain)
2018-12-28 17:09 EST, Len Merkel
no flags Details
--debug --extra --add-price-quotes SQLite data (28.33 KB, text/plain)
2018-12-28 17:10 EST, Len Merkel
no flags Details

Description Len Merkel 2018-12-27 20:44:20 EST
I am running GnuCash Version 3.3, Build 3.3+ (2018-09-29), Finance::Quote 1.47 on Windows 7 64-bit SP1. All Windows updates are current.

Running gnucash --add-price-quotes does not update any prices. 

Running "Get Quotes" from within GnuCash works fine. I have verified that all the gnc-fq-* scripts execute normally, retrieving prices. All commodities are defined to use Alphavantage (US) as the price source. I have defined the Windows environment variable ALPHAVANTAGE_API_KEY correctly.

If I redirect STDOUT and STDERR from gnucash --add-price-quotes, I get the following:

STDOUT:
Found Finance::Quote version 1.47

STDERR:
3:2018/12/27 17-18-04:gwen(6944):C:/gcdev64/gnucash/releases/src/gwenhywfar-4.20.0/src/base/i18n.c:  120: No translation found for WIN32 locale [English_United States.1252]

I am guessing that the error logged to STDERR is causing GnuCash to terminate immediately when running with the --add-price-quotes option. I do not have any other instances of GnuCash running at the time.

Any help is much appreciated. I would love to get automatic price quotes working.
Comment 1 John Ralls 2018-12-27 21:34:11 EST
No reason to believe that. Please attach a tracefile (https://wiki.gnucash.org/wiki/Trace_file) from a failed attempt to use --add-price-quotes.
Comment 2 Len Merkel 2018-12-28 14:59:22 EST
Created attachment 373083 [details]
Trace file as requested

Unedited trace file from running gnucash with --add-price-quotes. When running gnucash normally (i.e. in GUI), a trace file is created but is empty.
Comment 3 John Ralls 2018-12-28 16:56:59 EST
Hmm, not terribly enlightening, though it does rule out a crash. Try again with
  gnucash --debug --add-price-quotes
Which will add some progress reporting.
Comment 4 Len Merkel 2018-12-28 17:08:48 EST
I have now run gnucash --debug --extra --add-price-quotes, once against an XML .gnucash file, and once against a sqlite .gnucash file. The logs are almost identical, the small difference no doubt related to the different back-end data methods. Please see 2 new attachments.
Comment 5 Len Merkel 2018-12-28 17:09:48 EST
Created attachment 373084 [details]
--debug --extra --add-price-quotes XML data
Comment 6 Len Merkel 2018-12-28 17:10:25 EST
Created attachment 373085 [details]
--debug --extra --add-price-quotes SQLite data
Comment 7 John Ralls 2018-12-28 17:27:10 EST
Comment on attachment 373085 [details]
--debug --extra --add-price-quotes SQLite data

Are you passing the account file name as C:\path\to\file? If so try giving it "file:///C:/path/to/file" instead.
Comment 8 Len Merkel 2018-12-28 20:35:10 EST
Great! The file URI solved the problem. Thanks for the suggestion.

FYI, the URI needs to be: "file://C:/path/to/file". Inserting the extra "/" after the "file://" protocol results in a file not found error for file "/C:/path/to/file".
Comment 9 John Ralls 2018-12-28 22:27:36 EST
Great.

I've added a note to https://wiki.gnucash.org/wiki/Online_Quotes#Updating_enabled_Quotes_from_outside_GnuCash to help others.
Comment 10 Geert Janssens 2018-12-29 04:43:24 EST
Actually I believe this is a bug. GnuCash is supposed to be able to interpret local filesystem paths correctly. I have an idea where this goes wrong, though a proper fix will have to wait until I have access again to a windows development box/vm.

For now the workaround John suggested should unblock you.

Out of curiosity and extra test results, can you also try with this format:
/C/path/to/file

So without "file://" and without the colon after the C
Comment 11 Len Merkel 2018-12-29 19:35:25 EST
Here are some additional test results for you. FYI, gnucash, PERL, and the gnucash data file are all on the same drive (C:).

FAILURE:
=======
gnucash.exe --add-price-quotes C:\path\to\file
gnucash.exe --add-price-quotes C:/path/to/file
gnucash.exe --add-price-quotes \C\path\to\file
gnucash.exe --add-price-quotes /C/path/to/file

SUCCESS:
=======
gnucash.exe --add-price-quotes file://C:\path\to\file
gnucash.exe --add-price-quotes file://C:/path/to/file
gnucash.exe --add-price-quotes \path\to\file
gnucash.exe --add-price-quotes /path/to/file

Let me know if you need any more tests.
Comment 12 Jim DeLaHunt 2019-07-09 14:02:51 EDT
Is the essence of this issue, "gnucash --add-price-quotes always fails", as the title currently reads, or is it now focussed to, "gnucash.exe --add-price-quotes fails when Windows file path includes drive letter"?  

Reading this discussion, I think it is the latter. If so, then perhaps the issue title should be clarified.

I am having a problem with gnucash --add-price-quotes always fails on macOS. However, it does not involve drive letters. I suspect it is a separate problem. I will post my problem to the gnucash-user list for support first, and file a bug report if the list agrees it is actually a bug.

However, I still think it may be helpful to clarify the title of this issue.
Comment 13 John Ralls 2019-07-09 14:47:33 EDT
Jim, OK.

Note You need to log in before you can comment on or make changes to this bug.