webbrowser module bug?

Paul Boddie paul at boddie.org.uk
Fri May 25 19:18:51 EDT 2007


Ron Adam wrote:
>
> Reseting the default browser with the gnome default application window
> confirmed this.  The browser selection can either have the quotes around
> the args "%s" paremteter, or not depending on how and what sets it.
>
> Seems to me it should be quoted unless spaces in path names are never a
> problem in Linux.  So this could be both a python bug and a Gnome desktop
> bug.  Firefox probably does the right thing by putting the quotes around
> it, but that causes problems for webbrowser.py, which doesn't expect them.

Quoting arguments in the way described is the safe, easy option (with
some potential problems with ' characters that can be worked around),
and I imagine that it's done precisely because other applications
could pass a path with spaces as the URL, and that such applications
would be invoking the command in a shell environment. Sadly, this
conflicts with any other precautionary measures, causing a degree of
"overquoting".

Resetting the GNOME default is a workaround, but I'm not convinced
that it would be satisfactory. What happens if you try and open an
HTML file, in the file browser or some other application which uses
the desktop preferences, where the filename contains spaces?

Paul




More information about the Python-list mailing list