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:
[color=blue][color=green][color=darkred]
>>> import webbrowser
>>> webbrowser.open ("http://www.python.org" )[/color][/color][/color]
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:
[color=blue][color=green][color=darkred]
>>> import webbrowser
>>> webbrowser.brow ser[/color][/color][/color]
'netscape'
In the _browsers attribute there seems to be an entry for
'mozilla-firefox', but doesn't seem to work[color=blue][color=green][color=darkred]
>>> webbrowser._bro wsers[/color][/color][/color]
{'galeon': [None, <webbrowser.Gal eon instance at 0xb7d261cc>],
'mozilla': [None, <webbrowser.Net scape instance at 0xb7d2608c>],
'mozilla-firefox': [None, <webbrowser.Net scape instance at
0xb7d2612c>], 'w3m': [None, <webbrowser.Gen ericBrowser instance at
0xb7d22fec>]}
The tryorder is...[color=blue][color=green][color=darkred]
>>> webbrowser._try order[/color][/color][/color]
['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
--
During optimizing SPE for Ubuntu, I found something strange. I have
Ubuntu 5.10 "The Breezy Badger" and unfortunately this code is not
working:
[color=blue][color=green][color=darkred]
>>> import webbrowser
>>> webbrowser.open ("http://www.python.org" )[/color][/color][/color]
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:
[color=blue][color=green][color=darkred]
>>> import webbrowser
>>> webbrowser.brow ser[/color][/color][/color]
'netscape'
In the _browsers attribute there seems to be an entry for
'mozilla-firefox', but doesn't seem to work[color=blue][color=green][color=darkred]
>>> webbrowser._bro wsers[/color][/color][/color]
{'galeon': [None, <webbrowser.Gal eon instance at 0xb7d261cc>],
'mozilla': [None, <webbrowser.Net scape instance at 0xb7d2608c>],
'mozilla-firefox': [None, <webbrowser.Net scape instance at
0xb7d2612c>], 'w3m': [None, <webbrowser.Gen ericBrowser instance at
0xb7d22fec>]}
The tryorder is...[color=blue][color=green][color=darkred]
>>> webbrowser._try order[/color][/color][/color]
['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
--
Comment