Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect URL with webbrowser and firefox under Gnome #45398

Closed
bingham mannequin opened this issue Aug 29, 2007 · 4 comments
Closed

Incorrect URL with webbrowser and firefox under Gnome #45398

bingham mannequin opened this issue Aug 29, 2007 · 4 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@bingham
Copy link
Mannequin

bingham mannequin commented Aug 29, 2007

BPO 1057
Nosy @birkenfeld, @orsenthil

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2007-08-29.15:31:52.051>
created_at = <Date 2007-08-29.15:02:11.749>
labels = ['type-bug', 'library']
title = 'Incorrect URL with webbrowser and firefox under Gnome'
updated_at = <Date 2007-08-30.04:23:04.229>
user = 'https://bugs.python.org/bingham'

bugs.python.org fields:

activity = <Date 2007-08-30.04:23:04.229>
actor = 'orsenthil'
assignee = 'none'
closed = True
closed_date = <Date 2007-08-29.15:31:52.051>
closer = 'georg.brandl'
components = ['Library (Lib)']
creation = <Date 2007-08-29.15:02:11.749>
creator = 'bingham'
dependencies = []
files = []
hgrepos = []
issue_num = 1057
keywords = []
message_count = 4.0
messages = ['55421', '55422', '55458', '55459']
nosy_count = 3.0
nosy_names = ['georg.brandl', 'orsenthil', 'bingham']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue1057'
versions = ['Python 2.5']

@bingham
Copy link
Mannequin Author

bingham mannequin commented Aug 29, 2007

Under Gnome, Firefox will open the wrong URL when launched by
webbrowser. For example after running the following interactive session:

bingham@grizzly:~> python
Python 2.5.1 (r251:54863, Jun  6 2007, 13:42:30)
[GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import webbrowser
>>> webbrowser.open('http://www.python.org')
True

Firefox attempts to open the URL
file:///home/bingham/%22http://www.python.org%22.

This is caused by a bug in the Python standard library's webbrowser
module that only affects machines running Gnome.

On Gnome, webbrowser runs the command

gconftool-2 -g /desktop/gnome/url-handlers/http/command 2>/dev/null

to find the web browser, which prints out a browser command line like

/pkgs/Firefox/2.0/firefox "%s"

The quotes around "%s" are preserved when passing the command-line
arguments. The quotes prevent firefox from recognizing the URL and
firefox falls back to treating it as a file name. The webbrowser module
already handles extra quoting around the URL for the BROWSER environment
variable and this same treatment should be applied to the result of
gconftool-2.

The BROWSER environment variable issue, now fixed, is described at
http://bugs.python.org/issue1684254. The present issue was discussed in
an Ubuntu bug report
(https://bugs.launchpad.net/ubuntu/+source/python2.5/+bug/83974) but was
not resolved.

@bingham bingham mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Aug 29, 2007
@birkenfeld
Copy link
Member

The current code in the 2.5 branch uses shlex.split to postprocess the
command line returned by gconftool too, so this should be already fixed.

@orsenthil
Copy link
Member

I am on Fedora Core 3, gnome 2.6 and I am unable to reproduce this issue.
Could this be a Ubuntu configuration bug. Like adding " quotes after %s
for the firefox command?

@orsenthil
Copy link
Member

Okay. I found the status later. It was fixed then with Python 2.6 which
I am using.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants