I'm using Gnome under Mandrake 8.0 and getting very strange results using webbrowser (indirectly via pydoc). Apparently, Gnome's init code sets the BROWSER environment variable to "nautilus" (much to my surprise) and webbrowser trusts it as the god's honest truth, even though nautilus has not been registered with the webbrowser module (am I supposed to add that sort of stuff to site.py?). Accordingly, _tryorder is ['nautilus'] but doesn't appear in _browser.keys() is ['lynx', 'links', 'netscape', 'kfm', 'mozilla']. I think webbrowser should either ignore elements of BROWSER if they have not previously been registered (and can't be found by _iscommand) or try to register them using GenericBrowser. Users are apparently not the only people setting BROWSER, so the comment in the code:
# It's the user's responsibility to register handlers for any unknown # browser referenced by this value, before calling open().
seems like flawed logic to me.
Skip
Skip Montanaro skip@pobox.com:
I think webbrowser should either ignore elements of BROWSER if they have not previously been registered (and can't be found by _iscommand) or try to register them using GenericBrowser. Users are apparently not the only people setting BROWSER, so the comment in the code:
Fred Drake and I are co-responsible for that code. If you want to patch it to do this, I won't object.
Eric> Fred Drake and I are co-responsible for that code. If you want to Eric> patch it to do this, I won't object.
Here's a first pass that seems to work for me:
https://sourceforge.net/tracker/index.php?func=detail&aid=429136&gro...
though it doesn't attempt to recover if _tryorder winds up empty.
Skip
Skip Montanaro writes:
or try to register them using GenericBrowser. Users are apparently not the only people setting BROWSER, so the comment in the code:
# It's the user's responsibility to register handlers for any unknown # browser referenced by this value, before calling open().
seems like flawed logic to me.
Eric S. Raymond writes:
Fred Drake and I are co-responsible for that code. If you want to patch it to do this, I won't object.
I wouldn't object either. I *do* object to the system setting that variable by default by either Mandrake or Gnome -- that's just stupid and inconsiderate of the user. Now, if anyone can provide support for Nautilis, I won't object to that either. Unfortunately, Mandrake's installer stinks at upgrading (it couldn't seem to locate my 7.2 installation) and I don't have the time to figure that out.
-Fred