webbrowser module bug?
Ron Adam
rrr at ronadam.com
Sat May 26 11:43:56 EDT 2007
Paul Boddie wrote:
> 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?
I'm not sure how to test this. Most things I can think of call the web
browser directly. Maybe a link in an email?
Yes, it is a work around. The webbrowser module needs to be smarter about
quotes. As I said, this is fixed in 2.6 already. I emailed the module
maintainer, and will probably file a bug report too.
Ron
More information about the Python-list
mailing list