> On Dec 23, 2023, at 12:29 PM, Jim DeLaHunt <list+gnuc...@jdlh.com> wrote:
> 
> Hi, folks:
> 
> I recently upgraded to GnuCash 5.5-1 on macOS, from 4.14 and a long 
> succession of GnuCashes before that. I have been successfully retrieving 
> quotes via AlphaVantage for a long time. With the upgrade to GnuCash 5.5, 
> that stopped working.
> 
> When I run the GnuCash 5.5 application, and open the Price Database window, 
> the "Get Quotes" button is disabled.
> 
> When I ask gnucash-cli for quotes info, it says JSON::Parse is not installed:
> 
> % PATH='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin' 
> /Applications/Gnucash.app/Contents/MacOS/gnucash-cli --quotes info
> Application Path /Applications/Gnucash.app/Contents/MacOS/gnucash-cli
> Failed to initialize Finance::Quote: missing_modules JSON::Parse
> 
> Similarly, when I run the GnuCash 5.5 application in --debug mode, and look 
> at the log file, there is a message that JSON::Parse is missing:
> 
> /...[59 lines elided]...
> /* 11:45:37  INFO <gnc.gui> [scm_run_gnucash] Attempt to load Finance::Quote 
> returned this error message:
> * 11:45:37  INFO <gnc.gui> [scm_run_gnucash] Failed to initialize 
> Finance::Quote: missing_modules JSON::Parse
> /...[134,149 lines elided]...
> /
> 
> But the gnucash-fq-update utility thinks everything is fine:
> 
> % PATH='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin' sudo 
> /Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-update
> Password:
> 
> Starting with /...[elided].../ this dialog will disappear.
> Reading '/Users/jdlh/.cpan/Metadata'
>   Database was generated on Fri, 22 Dec 2023 23:54:07 GMT
> Test2 is up to date (1.302198).
> Finance::Quote is up to date (1.58).
> JSON::Parse is up to date (0.62).
> 
> And CPAN seems to think that JSON::Parse is present:
> 
> % PATH='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin' sudo cpan
> Password:
> Loading internal logger. Log::Log4perl recommended for better logging
> 
> Starting with /...[elided].../ this dialog will disappear.
> Terminal does not support /...[elided]...
> /cpan shell -- CPAN exploration and modules installation (v2.36)
> Enter 'h' for help.
> 
> cpan[1]> m JSON::Parse
> Reading '/Users/jdlh/.cpan/Metadata'
>   Database was generated on Fri, 22 Dec 2023 23:54:07 GMT
> Module id = JSON::Parse
>     CPAN_USERID  BKB (Ben Bullock <b...@cpan.org>)
>     CPAN_VERSION 0.62
>     CPAN_FILE    B/BK/BKB/JSON-Parse-0.62.tar.gz
>     UPLOAD_DATE  2022-07-15
>     MANPAGE      JSON::Parse - Parse JSON
>     INST_FILE /Library/Perl/5.30/darwin-thread-multi-2level/JSON/Parse.pm
>     INST_VERSION 0.62
> 
> 
> cpan[2]> install JSON::Parse
> JSON::Parse is up to date (0.62).
> 
> Note that I am using MacPorts on this system. That sometimes leads to 
> confusion, as described in 
> <https://wiki.gnucash.org/wiki/Online_Quotes#Multiple_Perl_installations_on_macOS>.
>  Thus I prefix commands with a PATH that excludes MacPorts, in the hopes that 
> I will be checking only the system Perl locations which the GnuCash app 
> consults.
> 
> For what it's worth, MacPorts has perl 5.34.3 installed, and the perl 5.34 
> edition of JSON::Parse as well. The system has perl 5.30.3 installed. I do 
> not know if this difference is significant.
> 
> I have read through the wiki page Online Quotes. I think I have done what 
> that page suggests. (Also, that page has now become a bit of a mess, because 
> it mixes together instructions for several different online quotes tools from 
> versions 5, 4, and pre-4 of GnuCash.)
> 
> Interestingly, when I run gnucash-cli from the GnuCash-provided application 
> and a path that includes MacPorts, it seems happy with the Finance::Quote 
> installation from MacPorts:
> 
>  % /Applications/Gnucash.app/Contents/MacOS/gnucash-cli --quotes info
> Application Path /Applications/Gnucash.app/Contents/MacOS/gnucash-cli
> Found Finance::Quote version 1.58.
> Finance::Quote sources:
> aex          alphavantage              amfiindia    asegr asx
> /...[elided].../
> xetra        yahoo_json   yahooweb     za
> 
> Thus I have a workaround: get quotes via gnucash-cli, which perhaps relies on 
> the MacPorts installation of Finance::Quote rather than the built-in 
> installation.
> 
> % /Applications/Gnucash.app/Contents/MacOS/gnucash-cli --quotes get 
> /...[elided].../ledger.gnucash
> Application Path /Applications/Gnucash.app/Contents/MacOS/gnucash-cli
> Found Finance::Quote version 1.58.
> %
> 
> Any suggestions for how to diagnose and fix the Get Quotes functionality 
> within the GnuCash application?
> 
> Thank you in advance for your help. And many thanks to the GnuCash developers 
> for all the improvements in the 5.x versions!

Jim,

It matters which perl is invoked, because each "minor" perl version (minor in 
quotes because just like GnuCash before we truncated the version to two digits, 
perl's "major" version has been fixed since the turn of the century) gets it's 
own versioned directories of modules.

It might also matter that one of the Perls is MacPorts because MacPorts might 
install its perl modules in the MacPorts installation tree.

You can use 
  perl -e 'print join("\n", @INC), "\n"`
(include the quotes) in each environment to see where that perl is looking for 
modules.

The value of $PATH is different when running from the command line in Terminal 
and when launching an app with LaunchServices, either by using the `open` 
command from a command line prompt or double-clicking the app's icon in Finder. 
Your terminal command line's PATH can be changed by your shell's startup files 
(e.g. ~/.bashrc and ~/.bash_profile) but LaunchServices uses only the system's 
default path, so the perl GnuCash.app sees is /usr/bin/perl and @INC will 
include only the  perl directories in /Library, /Network/Library, and 
/System/Library. cpan, when run with sudo (and it won't work otherwise without 
telling it to use a user space directory) installs to /Library/Perl/<Perl 
Version>/darwin-thread-multi-level, in your case 
/Library/Perl/5.30/darwin-thread-multi-level. 

You can force using that system perl on the command line by using the path 
instead of just `perl`, e.g.
  sudo /usr/bin/perl 
/Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-update

will force using the system perl and its builtin @INC as long as $PERL5LIB 
isn't set in the environment. 

Note that if your mac is an Apple Silicon one that you need to specify arch 
x86_64, as in 
  sudo arch -arch x86_64 /usr/bin/perl 
/Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-update

(all on one line) because otherwise perl will build and install F::Q and 
friends for Apple Silicon. GnuCash is built for Intel only because WebKitGtk 
doesn't work when built for Apple Silicon and GnuCash will run an x86_64 perl 
under Rosetta2; if a needed module isn't available for Intel then F::Q will 
fail.

Regards,
John Ralls




_______________________________________________
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.

Reply via email to