Determining an operating system's default browser

Juho Schultz juho.schultz at helsinki.fi
Fri Feb 10 05:51:54 EST 2006


John McMonagle wrote:
> Is there a python module which can determine an operating system's
> default web browser application.
> 
> I would like to use it in the following context:  I have a GUI
> application where all the documentation is written as html pages.  I
> wish to have these html help pages open in the default browser when
> selected from the application's Help menu
> 
> If python can determine the path to the default browser, I can then just
> spawn it.
> 
> Regards,
> 
> John McMonagle
> 
> 
> 
I think the htmlview command is used for this purpose (displaying html 
documentation of applications) on many Linuxes. So you could try 
os.system('htmlview'). Given the variety of Unixes (and even Linuxes) 
out there this is not a general solution.

So I would try htmlview first. If it does not work, the program could 
ask the user for his favourite browser the 1st time he looks at docs, 
and save this to a configuration file.



More information about the Python-list mailing list