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 2015年06月14日 21:33 by nedbat, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue24452.patch | Mariatta, 2016年10月06日 03:49 | review | ||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 552 | closed | dstufft, 2017年03月31日 16:36 | |
| Messages (17) | |||
|---|---|---|---|
| msg245351 - (view) | Author: Ned Batchelder (nedbat) * (Python triager) | Date: 2015年06月14日 21:33 | |
This doesn't work on Python 3.4 on a Mac with Yosemite and Chrome installed:
import webbrowser
webbrowser.get("chrome")
This patch makes it work:
```
*** /usr/local/pythonz/pythons/CPython-3.4.1/lib/python3.4/webbrowser.py 2014年09月21日 16:37:46.000000000 -0400
--- /Users/ned/foo/webbrowser.py 2015年06月14日 17:31:28.000000000 -0400
***************
*** 605,614 ****
--- 605,615 ----
# Don't clear _tryorder or _browsers since OS X can use above Unix support
# (but we prefer using the OS X specific stuff)
register("safari", None, MacOSXOSAScript('safari'), -1)
register("firefox", None, MacOSXOSAScript('firefox'), -1)
+ register("chrome", None, MacOSXOSAScript('chrome'), -1)
register("MacOSX", None, MacOSXOSAScript('default'), -1)
# OK, now that we know what the default preference orders for each
# platform are, allow user to override them with the BROWSER variable.
```
|
|||
| msg245355 - (view) | Author: Boštjan Mejak (PedanticHacker) * | Date: 2015年06月14日 23:16 | |
I must add that it doesn't work on Windows 7, Python 3.4.3, either. I do have chrome.exe on the %PATH% and executing 'chrome' in Windows Command Prompt opens up the Chrome browser nicely, but it doesn't work so nicely by doing this:
import webbrowser
webbrowser.get("chrome")
I get this error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python 3.4\lib\webbrowser.py", line 51, in get
raise Error("could not locate runnable browser")
webbrowser.Error: could not locate runnable browser
|
|||
| msg245359 - (view) | Author: Brandon Milam (jbmilam) * | Date: 2015年06月15日 01:17 | |
Boštjan Mejak the windows issue has been addressed in issue 8232 and recently patched for 3.5. http://bugs.python.org/issue8232 |
|||
| msg278167 - (view) | Author: Mariatta (Mariatta) * (Python committer) | Date: 2016年10月06日 03:49 | |
Well... I created a patch based on Ned's code :)
This now works in the default branch
Python 3.7.0a0 (default:f2204eaba685+, Oct 5 2016, 20:43:44)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import webbrowser
>>> webbrowser.get("chrome")
<webbrowser.MacOSXOSAScript object at 0x10adc7398>
>>> webbrowser.open_new("https://www.python.org")
True
Please review :)
|
|||
| msg278257 - (view) | Author: Senthil Kumaran (orsenthil) * (Python committer) | Date: 2016年10月07日 17:03 | |
The patch looks good to me. (The test coverage for chrome browser can be improved. But that seems a like a different change than the current one). |
|||
| msg278585 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2016年10月13日 18:08 | |
OK, this seems to work for me. I'm, applying this to 3.5, 3.6 and 3.7 (default). |
|||
| msg278588 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2016年10月13日 18:23 | |
New changeset bd0f502c5eea by Guido van Rossum in branch '3.5': Issue #24452: Make webbrowser support Chrome on Mac OS X. https://hg.python.org/cpython/rev/bd0f502c5eea New changeset 64a38f9aee21 by Guido van Rossum in branch '3.6': Issue #24452: Make webbrowser support Chrome on Mac OS X (merge 3.5->3.6) https://hg.python.org/cpython/rev/64a38f9aee21 |
|||
| msg278589 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2016年10月13日 18:25 | |
New changeset 4e2cce65e522 by Guido van Rossum in branch 'default': Issue #24452: Make webbrowser support Chrome on Mac OS X (merge 3.6->3.7) https://hg.python.org/cpython/rev/4e2cce65e522 |
|||
| msg278590 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2016年10月13日 18:29 | |
I applied this to 3.5, 3.6 and 3.7. I'm not sure we should also apply this to 2.7 -- optinions? Bug or feature? |
|||
| msg278591 - (view) | Author: Mariatta (Mariatta) * (Python committer) | Date: 2016年10月13日 18:40 | |
The documentation seems to indicate that chrome MacOS is supposed to work in 2.7, which makes this a bug. https://docs.python.org/2.7/library/webbrowser.html?highlight=webbrowser#module-webbrowser But... it could also be a documentation bug. |
|||
| msg278592 - (view) | Author: Senthil Kumaran (orsenthil) * (Python committer) | Date: 2016年10月13日 18:42 | |
Applying on 2.7 seems alright. Bug fix. |
|||
| msg278605 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2016年10月13日 20:28 | |
OK will do. |
|||
| msg278607 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2016年10月13日 20:30 | |
New changeset bc8a4b121aec by Guido van Rossum in branch '2.7': Issue #24452: Make webbrowser support Chrome on Mac OS X (backport to 2.7) https://hg.python.org/cpython/rev/bc8a4b121aec |
|||
| msg278608 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2016年10月13日 20:31 | |
Thanks everyone! Applied to 2.7, so closing as fixed now. |
|||
| msg281155 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2016年11月18日 18:28 | |
New changeset 0c8270cbdc62 by Brett Cannon in branch 'default': Issue #24452: add attribution https://hg.python.org/cpython/rev/0c8270cbdc62 |
|||
| msg290924 - (view) | Author: Boštjan Mejak (PedanticHacker) * | Date: 2017年03月31日 17:02 | |
I have Windows 10, 64-bit, and Python 3.6.1, 64-bit, and the code still does not work!
>>> import webbrowser
>>> webbrowser.get("chrome")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python 3.6\lib\webbrowser.py", line 51, in get
raise Error("could not locate runnable browser")
webbrowser.Error: could not locate runnable browser
Note: Yes, my Google Chrome browser was running when this command was executed.
|
|||
| msg290926 - (view) | Author: Mariatta (Mariatta) * (Python committer) | Date: 2017年03月31日 17:12 | |
Hi Boštjan Mejak, this ticket addresses the change for MacOS. The windows support is in http://bugs.python.org/issue8232. Please raise the issue there. Thanks. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:18 | admin | set | github: 68640 |
| 2017年03月31日 17:12:04 | Mariatta | set | messages: + msg290926 |
| 2017年03月31日 17:05:03 | gvanrossum | set | nosy:
- gvanrossum |
| 2017年03月31日 17:02:51 | PedanticHacker | set | messages: + msg290924 |
| 2017年03月31日 16:36:26 | dstufft | set | pull_requests: + pull_request1002 |
| 2016年11月18日 18:28:18 | python-dev | set | messages: + msg281155 |
| 2016年10月13日 20:31:28 | gvanrossum | set | status: open -> closed type: behavior messages: + msg278608 resolution: fixed stage: patch review -> resolved |
| 2016年10月13日 20:30:28 | python-dev | set | messages: + msg278607 |
| 2016年10月13日 20:28:12 | gvanrossum | set | messages: + msg278605 |
| 2016年10月13日 18:42:56 | orsenthil | set | messages: + msg278592 |
| 2016年10月13日 18:40:27 | Mariatta | set | messages: + msg278591 |
| 2016年10月13日 18:29:17 | gvanrossum | set | messages:
+ msg278590 versions: + Python 3.5 |
| 2016年10月13日 18:25:35 | python-dev | set | messages: + msg278589 |
| 2016年10月13日 18:23:02 | python-dev | set | nosy:
+ python-dev messages: + msg278588 |
| 2016年10月13日 18:08:09 | gvanrossum | set | nosy:
+ gvanrossum messages: + msg278585 |
| 2016年10月07日 17:03:54 | orsenthil | set | versions:
+ Python 3.7, - Python 3.4, Python 3.5 nosy: + orsenthil messages: + msg278257 assignee: orsenthil |
| 2016年10月06日 03:49:01 | Mariatta | set | files:
+ issue24452.patch nosy: + Mariatta messages: + msg278167 keywords: + patch |
| 2016年06月18日 17:58:37 | doughellmann | set | nosy:
+ doughellmann |
| 2015年06月15日 01:17:39 | jbmilam | set | nosy:
+ jbmilam messages: + msg245359 |
| 2015年06月14日 23:16:14 | PedanticHacker | set | nosy:
+ PedanticHacker messages: + msg245355 |
| 2015年06月14日 22:06:55 | ned.deily | set | nosy:
+ ronaldoussoren, ned.deily title: Make webbrowser support Chrome on Mac OS/X -> Make webbrowser support Chrome on Mac OS X versions: + Python 2.7, Python 3.5, Python 3.6 components: + macOS stage: patch review |
| 2015年06月14日 21:33:25 | nedbat | create | |