Determining an operating system's default browser

Paul Boddie paul at boddie.org.uk
Sun Feb 12 17:10:56 EST 2006


Jorgen Grahn wrote:
> On 11 Feb 2006 11:44:29 -0800, Paul Boddie <paul at boddie.org.uk> wrote:
> >
> > Indeed. Thanks for reminding me about mailcap/metamail - I used them in
>
> And thanks for mentioning the real name of that mechanism!

Happy memories! ;-)

[...]

> > import mailcap
>
> I guess I shouldn't be surprised that there is a standard module
> for that ... ;-)

It's another stop on the standard library mystery tour!

[...]

> > Sadly, when considering my KDE desktop's default browser, inquiring the
> > application for HTML files yields Mozilla Firefox from my mailcap file.
>
> Yes, but that's only because you haven't configured your mailcap, right?
> Which might be a real problem -- most people don't touch their .mailcaps,
> especially those who use KDE or Gnome.

Going by the following discussion, they abandoned interoperability with
mailcap and went with their own cocktail of new inventions:

https://listman.redhat.com/archives/xdg-list/2003-April/msg00009.html

The above message is where the mailcap-related arguing begins. It boils
over here:

https://listman.redhat.com/archives/xdg-list/2003-April/msg00031.html

> Also, sometimes you want a GUI browser to open, and sometimes you want a
> console-based one like lynx or w3m.  I guess most people who use mailcap do
> so because they use console-based mail readers, and thus want the HTML stuff
> appear inside the same terminal.  Another reason this might be unsuitable
> for the OP.
>
> So, while I called it "The One Correct Way" above, I admit it might not be a
> very good way ;-)

If there's one "correct" way, it would seem that the xdg people are
always interested in making at least one other "correct" way.
Nevertheless, in defence of the desktop module, its purpose is merely
to "open" things in the context of the current desktop: correct or
standards compliant file type identification doesn't necessarily enter
the picture. ;-)

Still, in the supported environments, desktop.open should do what the
user would expect, given the preference those environments typically
have for their "new and improved" way of doing things involving
configuration dialogues that the user might well have seen (and
probably closed very quickly in horror). Sadly, it doesn't seem to
involve mailcap files, however.

Paul




More information about the Python-list mailing list