Change External viewer and lookup in browser settings

How does one set or change the defaults for the external viewer and lookup in browser settings? I am using Picard 1.4.1 for OS X.

When I attempt to view the images with the “info” button, the image opens in Firefox rather than in Preview as it did in the previous version of Picard. “Lookup in browser” also defaults to Firefox rather than Chrome which is my default browser. Any help would be appreciated.

When you say “previous version”, do you mean 1.3.2 or 1.4.0? Lots of code changed between 1.3.2 and 1.4.0, but comparatively next to nothing changed from 1.4.0 to 1.4.1. So if they behaviour changed going from 1.4.0 to 1.4.1 it will be much easier to track down what changed.

I took a look at the changes between 1.3.2 and 1.4.1, and nothing springs forth for me. I looked for “Firefox” specifically too, but nothing has been added (or removed) that mentions this either. https://github.com/metabrainz/picard/compare/release-1.3.2...release-1.4.1#diff-bffeca12bea2a6898ee6236364866869 only changed things relevant to GNOME users, which you’re likely not, if you’re on Mac OS X.

So, in summary, 🤷. Maybe @samj1912 or someone will be able to provide more/better insight.

1 Like

Those features are using https://docs.python.org/2/library/webbrowser.html , behavior is somehow platform-specific.

1 Like

Thanks, I think i went straight from 1.3.2 to 1.4.1.

Most probably a change in core python webbrowser library as we did not change the picard webbrowser code in 1.4.x

So, does this mean it can’t be changed to my browser of choice? Nor image viewer of choice?

I am experiencing a very similar problem, where Picard is now using Firefox rather than Safari (my default browser). This indeed appears to be a bug that Apple introduced into Python in macOS 10.12.5. Andrew Jaffe gives a good description of the bug on his blog, http://www.andrewjaffe.net/blog/2017/05/python-bug-hunt.html

As for when Apple will fix it, ¯_(ツ)_/¯

2 Likes

I encountered the same issue after the most recent OS X update. Picard no longer opens up “Lookup manually” in my default browser (Safari). It is launching Firefox instead.

This is not Picards’ fault. This is a Mac OS X issue.

The Python webbrowser module will use osascript (AppleScript) to open the browser, using the command open location "<url>". It is that command that is now opening things in the wrong browser.

You can reproduce the issue with:

python -m webbrowser -t "http://www.python.org"

See https://forum.odrive.com/t/wrong-browser-opens-on-mac-10-12-5-osascript-bug/2482/5 for another community having the same issue. A fix is expected in MacOS 10.12.6.

What’s broken is the osascript command. Python executes this:

echo 'open location "http://www.python.org"' | osascript

and on Mac OS X 10.12.5 that gives an error message right now (error code -1708), at which point the webbrowser module moves on to trying Firefox and Safari, respectively.

I’m looking for a work-around still; Chrome may well have a command-line option to open URLs that we can use; when you set the BROWSER environment variable to that command (with a %s placeholder), that’ll be used instead of the currently b0rken default.

Workaround: set the BROWSER environment variable to:

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %action %s

Either set this globally for GUI by editing launchd.conf, or just launch Picard from a terminal window:

export BROWSER="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %action %s"
/Applications/MusicBrainz\ Picard.app/Contents/MacOS/MusicBrainz\ Picard &
1 Like

The global workaround mentioned by mjpieters no longer works with recent versions of macOS.

Updated workaround:

Create an org.musicbrainz.environment.plist file in ~/Library/LaunchAgents/ with this content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>org.musicbrainz.environment</string>
  <key>ProgramArguments</key>
  <array>
    <string>sh</string>
    <string>-c</string>
    <string>
    launchctl setenv BROWSER "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %action %s"
    </string>

  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

The plist will activate after system reboot. You can also use launchctl load ~/Library/LaunchAgents/org.musicbrainz.environment.plist to launch it immediately. Obviously, you should change the environment variable to the browser of your choice if you’re using something other than Chrome.

See the reference below for caveats.

Reference: