Firefox bug in webbrowser module on Ubuntu?!

SPE - Stani's Python Editor spe.stani.be at gmail.com
Fri Jan 20 18:45:02 CET 2006


Hi,

During optimizing SPE for Ubuntu, I found something strange. I have
Ubuntu 5.10 "The Breezy Badger" and unfortunately this code is not
working:

>>> import webbrowser
>>> webbrowser.open("http://www.python.org")

It does not throw an exception, but is not able to launch a browser.

Ubuntu ships with Firefox as its default browser, but it looks like it
is not recognized by the standard webbrowser module, instead it seems
to prefer Netscape, which is not installed:

>>> import webbrowser
>>> webbrowser.browser
'netscape'

In the _browsers attribute there seems to be an entry for
'mozilla-firefox', but doesn't seem to work
>>> webbrowser._browsers
{'galeon': [None, <webbrowser.Galeon instance at 0xb7d261cc>],
'mozilla': [None, <webbrowser.Netscape instance at 0xb7d2608c>],
'mozilla-firefox': [None, <webbrowser.Netscape instance at
0xb7d2612c>], 'w3m': [None, <webbrowser.GenericBrowser instance at
0xb7d22fec>]}

The tryorder is...
>>> webbrowser._tryorder
['galeon', 'mozilla-firefox', 'mozilla', 'w3m']

As a workaround I check for the file '/usr/bin/firefox' and use a
os.system call. Of course a user could maybe install Netscape, but it
would be absurd that SPE would require Netscape.

Is there a reason why this doesn't work? It looks like a bug.

Stani
--
http://pythonide.stani.be




More information about the Python-list mailing list