This section is the cause of the problem: for browser in ("mozilla-firefox", "mozilla-firebird", "mozilla", "netscape"): if _iscommand(browser): register(browser, None, Netscape(browser))
It's trying to load "mozilla-firefox" as the exec name instead of simply "firefox". A potential workaround *might* be to do this: import webbrowser if webbrowser._iscommand("firefox"): webbrowser.register("firefox", None, Netscape("firefox")) webbrowser.open("http://www.google.com/") ((Untested)) Best of luck SPE - Stani's Python Editor wrote: > 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 -- http://mail.python.org/mailman/listinfo/python-list