I really need webbrowser.open('file://') to open a web browser

Timur Tabi timur at freescale.com
Mon Jan 18 22:00:26 CET 2010

On Sat, Jan 16, 2010 at 3:43 PM, Paul Boddie <paul at boddie.org.uk> wrote:

> Generally, the desktop-specific tools should know that a browser is
> the appropriate application for an HTML file, and testing with both
> xdg-open, gnome-open and "kfmclient openURL" seems to open browsers on
> HTML files (using file:///...) for me (using KDE, Kubuntu 8.04). Of
> course, this depends on the settings in use on your desktop, but it
> should be noted that using "kfmclient exec" could have the effect you
> describe.

I'm using Gnome, and I have HTML files associated with Firefox.
However, my default web browser is Seamonkey, and when I do
webbrowser.open('http://...'), it opens that URL in Seamonkey, not
Firefox.  So if there is some Gnome association between an .html file
and a text editor, I don't know where it is defined.

> Not that I'm aware of. Sadly, standardisation of applications and
> services - having a command which can open a particular class of
> application (such as "e-mail reader", "Web browser") - seems to be
> absent from the free desktop arena, although I do recall there being a
> preferred applications dialogue in KDE, at least.

I would be sympathetic to this problem if the API were called
desktop.open(...).  But it's called webbrowser.open(), so it has to be
certain that a web browser is being at all times.  IMHO, any other
behavior is a bug.

Timur Tabi
Linux kernel developer at Freescale

More information about the Python-list mailing list