
Ping's complaints are justified -- I've been looking at and testing webbrowser.py and it's a mess. Among other things: 1. The BROWSER variable is not interpreted properly. 2. The code is stupid about loading platform support it doesn't need. 3. It's not possible to specify lynx as a browser under Unix, because the computation of available browsers is split in two and partly done inside the CommandLineBrowser class. 3. The module code is excessively hard to read, obscuring these bugs. Our mistake was hurriedly merging the launcher code from IDLE with the browser-finder hack I wrote (the guts of CommandLineBrowser). The resulting code is a bad, overcomplicated architecture with a nasty seam in it. As co-designer/implementor I should have caught this sooner, but I was in a hurry to get a CML2 prototype out the door and didn't test anything but the case I needed. My apologies to all. I'm rewriting to fix these problems now. Documented semantics of entry points will be preserved. -- <a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a> The politician attempts to remedy the evil by increasing the very thing that caused the evil in the first place: legal plunder. -- Frederick Bastiat

Ping's complaints are justified -- I've been looking at and testing webbrowser.py and it's a mess. Among other things:
1. The BROWSER variable is not interpreted properly.
2. The code is stupid about loading platform support it doesn't need.
3. It's not possible to specify lynx as a browser under Unix, because the computation of available browsers is split in two and partly done inside the CommandLineBrowser class.
3. The module code is excessively hard to read, obscuring these bugs.
Our mistake was hurriedly merging the launcher code from IDLE with the browser-finder hack I wrote (the guts of CommandLineBrowser). The resulting code is a bad, overcomplicated architecture with a nasty seam in it.
As co-designer/implementor I should have caught this sooner, but I was in a hurry to get a CML2 prototype out the door and didn't test anything but the case I needed. My apologies to all.
I'm rewriting to fix these problems now. Documented semantics of entry points will be preserved.
Excellent, Eric! That's the spirit. Can you point me to docs explaining the meaning of the BROWSER environment variable? I've never heard of it... The last new environment variables I learned were PAGER and EDITOR, probably 15 years ago when 4.1BSD was released... :-) --Guido van Rossum (home page: http://www.python.org/~guido/)

Guido van Rossum <guido@digicool.com>:
Can you point me to docs explaining the meaning of the BROWSER environment variable? I've never heard of it... The last new environment variables I learned were PAGER and EDITOR, probably 15 years ago when 4.1BSD was released... :-)
You've never heard of BROWSER because I invented it and have not widely popularized it yet :-). Ping knew about it either because he read the module code and saw that it was supposed to work, or because he remembered the design discussion when webbrowser.py was first implemented. I've had conversations with some key Perl and Tcl people (Larry Wall, Tom Christiansen, Clif Flynt) about the BROWSER convention, and they agree it's a good idea. I'll probably hack support for it into Perl's browser launcher next. It's documented in the version of libwebbrowser.tex now in the CVS tree. -- <a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a> Power concedes nothing without a demand. It never did, and it never will. Find out just what people will submit to, and you have found out the exact amount of injustice and wrong which will be imposed upon them; and these will continue until they are resisted with either words or blows, or with both. The limits of tyrants are prescribed by the endurance of those whom they oppress. -- Frederick Douglass, August 4, 1857

Guido van Rossum <guido@digicool.com>:
Can you point me to docs explaining the meaning of the BROWSER environment variable? I've never heard of it... The last new environment variables I learned were PAGER and EDITOR, probably 15 years ago when 4.1BSD was released... :-)
ESR replies:
You've never heard of BROWSER because I invented it and have not widely popularized it yet :-). Ping knew about it either because he read the module code and saw that it was supposed to work, or because he remembered the design discussion when webbrowser.py was first implemented.
I've had conversations with some key Perl and Tcl people (Larry Wall, Tom Christiansen, Clif Flynt) about the BROWSER convention, and they agree it's a good idea. I'll probably hack support for it into Perl's browser launcher next.
It's documented in the version of libwebbrowser.tex now in the CVS tree.
Grumble. That wasn't the kind of answer I expected. I don't like it if Python is used as a wedge to get a particular thing introduced to the rest of the world, no matter how useful it may seem at the time. If something is already a popular convention, I'll happily adopt it, but I'm not comfortable being put in front of somebody else's cart. There just are too many carts that would like to be pulled by a horse as strong as Python, and I don't want to take sides if I can avoid it. BROWSER seems unlikely to take the world by storm and I don't feel I need to be involved in the effort to get it accepted. (And yes, I know there are enough cases where I *did* take sides. There were some cases where I *do* want to take a side, and there were some mistakes -- which is one of the reasons why I'm shy about taking sides now.) Anyway, shouldn't you also talk to the developers of packages like KDE and Gnome? Surely their users would like to be able to configure the default webbrowser. Talking just to the scripting language people seems like you're thinking too small. There must be lots of C apps with the desire to invoke a browser. Also Emacs, which has an extensive list of browser-url-* functions (you might even learn a few tricks from it about how to invoke various external browsers) but AFAIK no default browser selection. --Guido van Rossum (home page: http://www.python.org/~guido/)

Guido> BROWSER seems unlikely to take the world by storm and I don't Guido> feel I need to be involved in the effort to get it accepted. Editors and web browsers are classes of tools which (one would hope) will always come in several varieties. Users have to have some way to specify what to launch. BROWSER seems analogous to the EDITOR environment variable which is commonly used in Unix environments for just that purpose. Skip

[Guido]
Can you point me to docs explaining the meaning of the BROWSER environment variable? I've never heard of it... The last new environment variables I learned were PAGER and EDITOR, probably 15 years ago when 4.1BSD was released... :-)
I gotta say, politics aside, BROWSER is a screamingly natural answer to the question "what comes next in this sequence?": PAGER, EDITOR, ... Dear Lord, even *I* use a browser almost every week <wink>. explicit-is-better-than-implicit-ly y'rs - tim

Tim Peters <tim.one@home.com>:
I gotta say, politics aside, BROWSER is a screamingly natural answer to the question "what comes next in this sequence?":
PAGER, EDITOR, ...
That's exactly what I thought when I was struck by the obvious. Everybody I spread this meme to seems to agree. -- <a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a> Government is actually the worst failure of civilized man. There has never been a really good one, and even those that are most tolerable are arbitrary, cruel, grasping and unintelligent. -- H. L. Mencken

How will the expected adherence of apps to BROWSER jive with the current (and poorly understood by me) Windows convention of specifying the "default" browser somewhere in the registry? Trent -- Trent Mick TrentM@ActiveState.com

Trent Mick <trentm@ActiveState.com>:
How will the expected adherence of apps to BROWSER jive with the current (and poorly understood by me) Windows convention of specifying the "default" browser somewhere in the registry?
BROWSER overrides the registry setting. Which is OK; under Windows, only wizards are going to muck with it. -- <a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a> Ideology, politics and journalism, which luxuriate in failure, are impotent in the face of hope and joy. -- P. J. O'Rourke

Guys, while I like BROWSER, don't think it has anything to do with Windows! Windows is not Unix; doesn't have PAGER or EDITOR either; and, in general, use of envars is an abomination under Windows. The old webbrowser.py uses the Windows-specific os.startfile(url) because that's the *right* way to do it on Windows, wizard or not. And you would have to be a Windows wizard to succeed in launching a browser under Windows in any other way anyway. You may as well try to sell the notion that, on Unix, Python should maintain a dict mapping file extensions to the user's preferred ways of opening such files <0.9 wink>.

On Wed, 24 Jan 2001 08:49:17 -0800, Trent Mick <trentm@ActiveState.com> wrote:
How will the expected adherence of apps to BROWSER jive with the current (and poorly understood by me) Windows convention of specifying the "default" browser somewhere in the registry?
The "webbrowser" module should prefer to take the setting from the registry on windows. -- Moshe Zadka <sig@zadka.site.co.il> This is a signature anti-virus. Please stop the spread of signature viruses! Fingerprint: 4BD1 7705 EEC0 260A 7F21 4817 C7FC A636 46D0 1BD6

Moshe Zadka <moshez@zadka.site.co.il>:
How will the expected adherence of apps to BROWSER jive with the current (and poorly understood by me) Windows convention of specifying the "default" browser somewhere in the registry?
The "webbrowser" module should prefer to take the setting from the registry on windows.
Um, that's not the way it works right now. The windows-default browser choice launches the registered default browser, but BROWSER may have something else in its search list first. -- <a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a> The real point of audits is to instill fear, not to extract revenue; the IRS aims at winning through intimidation and (thereby) getting maximum voluntary compliance -- Paul Strassel, former IRS Headquarters Agent Wall St. Journal 1980

"Eric" == Eric S Raymond <esr@thyrsus.com> writes:
Moshe Zadka <moshez@zadka.site.co.il>: >> The "webbrowser" module should prefer to take the setting from the >> registry on windows. Eric> Um, that's not the way it works right now. The windows-default Eric> browser choice launches the registered default browser, but Eric> BROWSER may have something else in its search list first. Why not have a special REGISTRY token you can place in the BROWSER path to tell it when to consult the registry? On non-Windows platforms it can simply be ignored: BROWSER=netscape:REGISTRY:explorer Skip

Skip Montanaro <skip@mojam.com>:
Why not have a special REGISTRY token you can place in the BROWSER path to tell it when to consult the registry? On non-Windows platforms it can simply be ignored:
In effect, windows-default is that special token. -- <a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a> The Bible is not my book, and Christianity is not my religion. I could never give assent to the long, complicated statements of Christian dogma. -- Abraham Lincoln

On Thu, Jan 25, 2001 at 07:05:44PM +0200, Moshe Zadka wrote:
On Wed, 24 Jan 2001 08:49:17 -0800, Trent Mick <trentm@ActiveState.com> wrote:
How will the expected adherence of apps to BROWSER jive with the current (and poorly understood by me) Windows convention of specifying the "default" browser somewhere in the registry?
The "webbrowser" module should prefer to take the setting from the registry on windows.
Why ? That's a lot harder to change, and not settable per 'shell'/'thread'/'process'. -- Thomas Wouters <thomas@xs4all.net> Hi! I'm a .signature virus! copy me into your .signature file to help me spread!

The "webbrowser" module should prefer to take the setting from the registry on windows.
Why ? That's a lot harder to change, and not settable per 'shell'/'thread'/'process'.
A Windows user has a legitimate expectation that *every* time an .html file is opened, it will come up in their browser of choice. That choice is made via the registry, and this is how *all* apps work under Windows. Ditto for .htm files (and that may be a different browser than is used for .html files, but again the user has set up their registry to do what *they* want done with it). It's not supposed to be easy to change; it is supposed to be consistent. Using a different browser per shell/thread/process is a foreign concept; it's also a useless concept on Windows <0.5 wink>.

Guido van Rossum <guido@digicool.com>:
Grumble. That wasn't the kind of answer I expected. I don't like it if Python is used as a wedge to get a particular thing introduced to the rest of the world, no matter how useful it may seem at the time.
Oh, stop! I'm not using Python as an argument for other people to adopt the BROWSER convention. The idea sells itself quite nicely by analogy to EDITOR and PAGER the second people hear it.
Anyway, shouldn't you also talk to the developers of packages like KDE and Gnome? Surely their users would like to be able to configure the default webbrowser. Talking just to the scripting language people seems like you're thinking too small. There must be lots of C apps with the desire to invoke a browser. Also Emacs, which has an extensive list of browser-url-* functions (you might even learn a few tricks from it about how to invoke various external browsers) but AFAIK no default browser selection.
All on my TO-DO list. -- <a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a> It is proper to take alarm at the first experiment on our liberties. We hold this prudent jealousy to be the first duty of citizens and one of the noblest characteristics of the late Revolution. The freemen of America did not wait till usurped power had strengthened itself by exercise and entangled the question in precedents. They saw all the consequences in the principle, and they avoided the consequences by denying the principle. We revere this lesson too much ... to forget it -- James Madison.

On Tue, 23 Jan 2001 22:46:47 -0500, Guido van Rossum <guido@digicool.com> wrote: [ESR]
You've never heard of BROWSER because I invented it and have not widely popularized it yet :-).
[Guido v. Rossum]
Grumble. That wasn't the kind of answer I expected. I don't like it if Python is used as a wedge to get a particular thing introduced to the rest of the world, no matter how useful it may seem at the time.
Guido, I think you're being over-dramatic. BROWSER is right in the tradition of PAGER and EDITOR, and a lot of other programs need it. I know Eric uses RH and mutt, so probably RH's urlview program (which mutt uses to jump to URLs) uses BROWSER. I was just about to submit a bug report to Debian that their urlview doesn't respect it. And if you really don't want to be a horse in front of a cart...
Anyway, shouldn't you also talk to the developers of packages like KDE and Gnome? Surely their users would like to be able to configure the default webbrowser.
Yes -- via GNOME/KDE specific mechanisms. I have 0 experience with KDE, but I'm guessing the GNOME guys would do it via the GNOME "registry". KDE probably has something similar. I'm sure you wouldn't want Python to depend on GNOME, though it would be nice to make the browser-choosing part pluggable so when "import gnome" is done, it automatically tries to choose the user's browser. On UNIX (as opposed to GNOME/KDE, which are pretty much operating systems themselves), these things are done via environment variable. And $BROWSER doesn't seem like that much of an innovation. -- Moshe Zadka <sig@zadka.site.co.il> This is a signature anti-virus. Please stop the spread of signature viruses! Fingerprint: 4BD1 7705 EEC0 260A 7F21 4817 C7FC A636 46D0 1BD6

Moshe Zadka <moshez@zadka.site.co.il>:
I know Eric uses RH and mutt, so probably RH's urlview program (which mutt uses to jump to URLs) uses BROWSER. I was just about to submit a bug report to Debian that their urlview doesn't respect it.
Oh, *do* that! Note: BROWSER may consist of a colon-separated series of parts, browser commands to be tried in order (this is useful so you can put an X browser first, then a console browser, and have the right thing happen). If a part contains %s, the URL is substituted there; otherwise, the URL is concatenated to the command after a space. -- <a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a> Gun Control: The theory that a woman found dead in an alley, raped and strangled with her panty hose, is somehow morally superior to a woman explaining to police how her attacker got that fatal bullet wound. -- L. Neil Smith
participants (7)
-
Eric S. Raymond
-
Guido van Rossum
-
Moshe Zadka
-
Skip Montanaro
-
Thomas Wouters
-
Tim Peters
-
Trent Mick