Determining an operating system's default browser

Jorgen Grahn grahn+nntp at snipabacken.dyndns.org
Sat Feb 11 14:23:39 EST 2006


On 10 Feb 2006 03:51:01 -0800, Paul Boddie <paul at boddie.org.uk> wrote:
> John McMonagle wrote:
>> On Thu, 2006-02-09 at 17:53 -0600, Larry Bates wrote:
>> > You don't have to determine it.  Just os.startfile('page1.html')
>> > and let the OS figure it out.
>>
>> Works great for Windows - not available on Unix though.
>
> Take a look at the desktop module for similar functionality for KDE,
> GNOME and the Mac OS X desktop environment (as well as Windows, of
> course):

Note that those do not, of course, work on all Unices.

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.

This mechanism is widespread under Unix, I think ... but I don't know if
there is a general interface to it, or a Python interface.

/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