473,770 Members | 5,299 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

webbrowser module bug?


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.op en('http://www.python.org' )
True
>>>
It opens firefox as expected, but the url is ...

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

Which of course doesn't do what is expected.

Any ideas?

Ron

May 24 '07 #1
14 2099
On May 24, 5:03 pm, Ron Adam <r...@ronadam.c omwrote:
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.op en('http://www.python.org' )
True
>>>

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

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

Which of course doesn't do what is expected.

Any ideas?

Ron
I don't know. This works for me with Python 2.4 on Windows XP SP2. The
docs don't say much (http://docs.python.org/lib/module-
webbrowser.html ). Maybe it would be beneficial to read the module's
code? Or use the "register" command manually?

Mike

May 25 '07 #2
ky******@gmail. com wrote:
On May 24, 5:03 pm, Ron Adam <r...@ronadam.c omwrote:
>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.op en('http://www.python.org' )
True
> >>>

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

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

Which of course doesn't do what is expected.

Any ideas?

Ron

I don't know. This works for me with Python 2.4 on Windows XP SP2. The
docs don't say much (http://docs.python.org/lib/module-
webbrowser.html ). Maybe it would be beneficial to read the module's
code? Or use the "register" command manually?
It works for me on python 2.4 also, but not on later versions.

Looks like I'll need to try to test the url at the point where it calls the
browser from webbrowser.py.

Can someone else test this on python 2.5?

Ron
May 25 '07 #3
Ron Adam wrote:
ky******@gmail. com wrote:
>On May 24, 5:03 pm, Ron Adam <r...@ronadam.c omwrote:
>>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.op en('http://www.python.org' )
True
>>>

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

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

Which of course doesn't do what is expected.

Any ideas?

Ron
I don't know. This works for me with Python 2.4 on Windows XP SP2. The
docs don't say much (http://docs.python.org/lib/module-
webbrowser.htm l). Maybe it would be beneficial to read the module's
code? Or use the "register" command manually?

It works for me on python 2.4 also, but not on later versions.

Looks like I'll need to try to test the url at the point where it calls the
browser from webbrowser.py.

Can someone else test this on python 2.5?
On my Windows laptop it works on 2.4.1 and 2.5.1 native, but not on
2.5.1 for Cygwin.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
------------------ Asciimercial ---------------------
Get on the web: Blog, lens and tag your way to fame!!
holdenweb.blogs pot.com squidoo.com/pythonology
tagged items: del.icio.us/steve.holden/python
All these services currently offer free registration!
-------------- Thank You for Reading ----------------

May 25 '07 #4
Ron Adam wrote:
ky******@gmail. com wrote:
>On May 24, 5:03 pm, Ron Adam <r...@ronadam.c omwrote:
>>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.op en('http://www.python.org' )
True
>>>

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

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

Which of course doesn't do what is expected.

Any ideas?

Ron
I don't know. This works for me with Python 2.4 on Windows XP SP2. The
docs don't say much (http://docs.python.org/lib/module-
webbrowser.htm l). Maybe it would be beneficial to read the module's
code? Or use the "register" command manually?

It works for me on python 2.4 also, but not on later versions.

Looks like I'll need to try to test the url at the point where it calls the
browser from webbrowser.py.

Can someone else test this on python 2.5?
On my Windows laptop it works on 2.4.1 and 2.5.1 native, but not on
2.5.1 for Cygwin.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
------------------ Asciimercial ---------------------
Get on the web: Blog, lens and tag your way to fame!!
holdenweb.blogs pot.com squidoo.com/pythonology
tagged items: del.icio.us/steve.holden/python
All these services currently offer free registration!
-------------- Thank You for Reading ----------------
May 25 '07 #5
Ron Adam said unto the world upon 05/25/2007 12:28 PM:
ky******@gmail. com wrote:
>On May 24, 5:03 pm, Ron Adam <r...@ronadam.c omwrote:
>>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.op en('http://www.python.org' )
True
>>>

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

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

Which of course doesn't do what is expected.

Any ideas?
<snip>
>
It works for me on python 2.4 also, but not on later versions.

Looks like I'll need to try to test the url at the point where it calls the
browser from webbrowser.py.

Can someone else test this on python 2.5?

Ron
Works fine for me on ubuntu 7.04 (fiesty) with Python 2.5.1c1, which
appear to be your set-up, too.

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.op en('http://www.python.org' )
True
>>>

Best,

Brian vdB

May 25 '07 #6
Brian van den Broek wrote:
Ron Adam said unto the world upon 05/25/2007 12:28 PM:
>ky******@gmail. com wrote:
>>On May 24, 5:03 pm, Ron Adam <r...@ronadam.c omwrote:
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.op en('http://www.python.org' )
True
>>>

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

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

Which of course doesn't do what is expected.

Any ideas?

<snip>
>It works for me on python 2.4 also, but not on later versions.

Looks like I'll need to try to test the url at the point where it calls the
browser from webbrowser.py.

Can someone else test this on python 2.5?

Ron

Works fine for me on ubuntu 7.04 (fiesty) with Python 2.5.1c1, which
appear to be your set-up, too.

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.op en('http://www.python.org' )
True
>>>

Best,

Brian vdB
Thanks,

This is strange. Now I have no idea where to look. (?)
I get the same incorrect results doing...

ron@home:~$ python2.5 -m webbrowser 'http://www.python.org'

Firefox attempts to open...

file:///home/ron/%22http://www.python.org% 22
The following works ok:

ron@home:~$ firefox 'http://www.python.org'
Works in the Ubuntu 2.4.4 dist (But blocks until the browser is closed.)

Doesn't work in the Ubuntu 2.5.1c1 dist
Python 2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25)

Doesn't work in the 2.5 maintenance branch
Python 2.5 (release25-maint:54563, May 24 2007, 18:33:45)

Works in the 2.6 branch (trunk)
Works in the 3.0 branch
I'll try uninstalling and reinstalling. The Ubuntu 2.5 dist.

None of the svn versions are on the path, so it shouldn't be a path
conflict with them.

Ron
May 25 '07 #7

Steve Holden wrote:
Ron Adam wrote:
>ky******@gmail. com wrote:
>>On May 24, 5:03 pm, Ron Adam <r...@ronadam.c omwrote:
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.op en('http://www.python.org' )
True
>>>

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

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

Which of course doesn't do what is expected.

Any ideas?

Ron
I don't know. This works for me with Python 2.4 on Windows XP SP2. The
docs don't say much (http://docs.python.org/lib/module-
webbrowser.ht ml). Maybe it would be beneficial to read the module's
code? Or use the "register" command manually?
It works for me on python 2.4 also, but not on later versions.

Looks like I'll need to try to test the url at the point where it calls the
browser from webbrowser.py.

Can someone else test this on python 2.5?
On my Windows laptop it works on 2.4.1 and 2.5.1 native, but not on
2.5.1 for Cygwin.
Does it mangle the url in the same way?

If so, then that would be enough to file a bug report.

It's maybe not due to the webbrowser module it self, but maybe something
else that's platform dependent?

Can anyone else reproduce this?

Ron
May 25 '07 #8
On 25 May, 00:03, Ron Adam <r...@ronadam.c omwrote:
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.op en('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

May 25 '07 #9
Paul Boddie wrote:
On 25 May, 00:03, Ron Adam <r...@ronadam.c omwrote:
>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.op en('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.Pop en call.
This works
>>subprocess.Po pen(['firefox', 'http://python.org'])
<subprocess.Pop en object at 0xb7ddbeec>
This reproduces the problem I'm having.
>>subprocess.Po pen(['firefox', '"http://python.org"'])
<subprocess.Pop en 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

May 25 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3495
by: Matthias Huening | last post by:
Hi, os.startfile('http://www.python.org') works fine on WinXP with IE as default webbrowser. With Mozilla Firefox 0.9 as default webbrowser, however, I get an error. Firefox starts, the page gets loaded and then Python gives me an error message (Traceback below). The same is true for the webbowser module. Is this a Python problem or a Firefox problem? Matthias
5
3119
by: SPE - Stani's Python Editor | last post by:
Hi, During optimizing SPE for Ubuntu, I found something strange. I have Ubuntu 5.10 "The Breezy Badger" and unfortunately this code is not working: >>> import webbrowser >>> webbrowser.open("http://www.python.org") It does not throw an exception, but is not able to launch a browser.
19
2364
by: Blair P. Houghton | last post by:
I'm just learning Python, so bear with. I was messing around with the webbrowser module and decided it was pretty cool to have the browser open a URL from within a python script, so I wrote a short script to open a local file the same way, using the script file as an example target: # browser-test.py import webbrowser import sys
0
1419
by: robin | last post by:
hi, i'm using the webbrowser module to open url's in safari or firefox. specifically i'm using the webbrowser.open('http://...', new=0) command. however, even though i say new=0 my url is always opened in a new browser window. what can i do, so my link is opened in an already open browser window?
8
4633
by: Dustan | last post by:
At http://docs.python.org/whatsnew/modules.html on the webbrowser module, it says "A number of additional browsers were added to the supported list such as Firefox, Opera, Konqueror, and elinks." I just installed python 2.5, looking forward to being able to control firefox without having to make it my default browser, but... I don't seem to have that functionality. In IDLE: {'windows-default': }
4
3753
by: Gregory Bloom | last post by:
I'm running Python 2.5 under Windows. If I fire up IDLE and enter: it works like a champ, opening the page in Firefox. Same thing goes from a Windows cmd shell: it works as advertised. But if I open a cygwin bash shell and try the same thing from a python prompt, I get: Traceback (most recent call last):
1
1551
by: pmclinn | last post by:
I have some webbrowser code using the .net 2.0 control on a form. I want to remove the form and run the proceedure from a module but I cannot seem to get the code to work. Code in form that works: WebBrowser1.Navigate("http://website") in the completed event handler I have this Static quit As Integer = 0 If quit = 0 Then
2
2771
by: krishnakant Mane | last post by:
hello all, as I posted in my previous thread, I am generating html reports for my client software. I am yet to find a satisfactory module which can help me actually create headings, bold and italics etc without merging html with data variables. any ways I am right now doing the hamd coding myself. may be I have overlooked some module. right now I am in the process of trying templayer. but my main issue is that when I use the
2
1599
by: scottbvfx | last post by:
Hi, I'm trying to launch a web browser along with an html file with a fragment identifier in its path. I'm using the webbrowser module for this. ie. webbrowser.open('file:///C:/myfile.html#SomeEntryInTheHTML') for some reason it is truncating the path to 'file:///C:/myfile.html'. Does anyone know a way of getting the fragment identifier in there
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8880
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3969
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.