Re: webbrowser module bug?



Paul Boddie wrote:
On 25 May, 00:03, Ron Adam <r...@xxxxxxxxxxx> wrote:
Is anyone else having problems with the webbrowser module?

Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import webbrowser
>>> webbrowser.open('http://www.python.org')
True
>>>

It opens firefox as expected, but the url is ...

file:///home/ron/%22http://www.python.org%22

Since %22 is the URL-encoded double-quote character ("), I can only
imagine that something is quoting the URL for the shell, resulting in
the following command:

firefox '"http://www.python.org/";'

Or something similar, at least. Firefox 1.5 seems to refuse to open
such URLs, though.

Paul

Yes, thats it. I've traced it down the the subproccess.Popen call.


This works

>>> subprocess.Popen(['firefox', 'http://python.org'])
<subprocess.Popen object at 0xb7ddbeec>


This reproduces the problem I'm having.

>>> subprocess.Popen(['firefox', '"http://python.org";'])
<subprocess.Popen object at 0xb7ddbf4c>

The quoting does happen in the webbrowser module.

The cmdline is passed as...

['/usr/lib/firefox/firefox', '"http://python.org";']



I've traced it back to the following line where self.args is ['"%s"']

Line 187 in webbrowser.py:

cmdline = [self.name] + [arg.replace("%s", url)
for arg in self.args]

Now I just need to figure out why self.args is double quoted.

Cheers,
Ron





.



Relevant Pages

  • Re: webbrowser module bug?
    ... It opens firefox as expected, ... The quoting does happen in the webbrowser module. ... It looks like the problem started when I told firefox to make itself the default browser. ...
    (comp.lang.python)
  • Re: webbrowser module bug?
    ... >>> import webbrowser ... It opens firefox as expected, ... Since %22 is the URL-encoded double-quote character, ...
    (comp.lang.python)
  • Re: os.startfile / webbrowser + Firefox
    ... With Mozilla Firefox 0.9 as default webbrowser, ... | Python gives me an error message (Traceback below). ... Is this a Python problem or a Firefox ...
    (comp.lang.python)
  • Re: Problems with setting default mail handler
    ... The newsgroup convention requires quoting of what went before ... because it is not a one-to-one communications method like email, ... at all opening shortcuts in Firefox from within WLM? ... since I have visual problems and the more text there is to plough ...
    (microsoft.public.windows.vista.mail)
  • os.startfile / webbrowser + Firefox
    ... With Mozilla Firefox 0.9 as default webbrowser, ... Python gives me an error message (Traceback below). ... Das System kann die angegebene Datei ...
    (comp.lang.python)