Determining an operating system's default browser

Jorgen Grahn grahn+nntp at snipabacken.dyndns.org
Sun Feb 12 16:17:14 EST 2006


On 11 Feb 2006 11:44:29 -0800, Paul Boddie <paul at boddie.org.uk> wrote:
> Jorgen Grahn wrote:
...
>> On my machines, there is One Correct Way of doing these things, and that's
>> to look in the MIME support/configuration files (~/.mailcap, and so on),
>> first for the user, then system-wide. Something there might tell you what
>> program should handle text/html content.
>
> Indeed. Thanks for reminding me about mailcap/metamail - I used them in

And thanks for mentioning the real name of that mechanism!

...
> import mailcap

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

...
> 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.

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 ;-)

/Jorgen

-- 
  // Jorgen Grahn <grahn@        Ph'nglui mglw'nafh Cthulhu
\X/     snipabacken.dyndns.org>  R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list