Paul Boddie wrote:
> On 25 May, 00:03, Ron Adam <[EMAIL PROTECTED]> 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





-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to