Re: webbrowser module bug?
- From: Ron Adam <rrr@xxxxxxxxxxx>
- Date: Fri, 25 May 2007 14:19:11 -0500
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
.
- References:
- webbrowser module bug?
- From: Ron Adam
- Re: webbrowser module bug?
- From: Paul Boddie
- webbrowser module bug?
- Prev by Date: Re: Module listing in order.
- Next by Date: Re: Module listing in order.
- Previous by thread: Re: webbrowser module bug?
- Next by thread: Re: webbrowser module bug?
- Index(es):
Relevant Pages
|