This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2008年07月09日 21:36 by AdrianP, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg69488 - (view) | Author: Adrian Petrescu (AdrianP) | Date: 2008年07月09日 21:36 | |
The webbrowser module seems to treat URLs containing the "|" character differently based on whether the browser is already running or not. For instance, consider the following python script: import webbrowser url = "http://foo.com/bar.html?var=x|y|z" webbrowser.open(url) If you run this script while the browser is already running (so that webbrowser.open creates a new tab) this behaves as you would expect, with the given URL as an address. However, if a browser is not already running, when webbrowser.open creates it, it seems to interpret the "|" as a seperator character, so that the browser will open with THREE tabs, one open to "http://foo.com/bar.html?var=x", one to "http://y" and one to "http://z". This is clearly a bug, webbrowser module should be smart enough to escape the "|" character if the browser is interpreting that line differently. This happens in Linux with Python 2.5 and Firefox 3.0. Not sure if it happens with anything else. |
|||
| msg69489 - (view) | Author: Adrian Petrescu (AdrianP) | Date: 2008年07月09日 21:38 | |
Just as an aside, the reason I consider this a fairly serious bug is that the Google Charts API urls make heavy use of the '|' character, which means if I want to have Python use it by opening the user's browser, it won't work if they don't already have a browser open. |
|||
| msg69506 - (view) | Author: Matt Giuca (mgiuca) | Date: 2008年07月10日 15:44 | |
I was able to duplicate this, but it's an issue with Firefox, not Python. webbrowser.open(url) just passes url as a command line argument to the web browser; it doesn't do any manipulation. Note that you get the exact same behaviour if you run Firefox from the command line: > firefox 'http://foo.com/bar.html?var=x|y|z' Opens this URL in a new tab if it's already open, but splits on '|' and opens in 3 separate tabs if Firefox isn't running. Note also that while this string is a URL, it isn't properly normalized. This works fine if you call webbrowser.open("http://foo.com/bar.html?var=x%7Cy%7Cz") (Which you can only obtain programmatically by generating the URL properly in the first place, by using urllib.urlencode, or urllib.quote on the value string "x|y|z"). |
|||
| msg70021 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2008年07月19日 13:12 | |
Closing as invalid. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:36 | admin | set | github: 47580 |
| 2008年07月19日 13:12:54 | georg.brandl | set | status: open -> closed resolution: not a bug messages: + msg70021 nosy: + georg.brandl |
| 2008年07月10日 15:44:10 | mgiuca | set | nosy:
+ mgiuca messages: + msg69506 |
| 2008年07月09日 21:38:55 | AdrianP | set | messages: + msg69489 |
| 2008年07月09日 21:36:59 | AdrianP | create | |