msg249316 - (view) |
Author: Simon Conseil (sconseil) * |
Date: 2015-08-29 10:01 |
Hi, There is an issue in the webbrowser module for Mac OS when the BROWSER environment variable is set: Python 2.7.10 (default, Jul 14 2015, 19:46:27) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin Type "help", "copyright", "credits" or "license" for more information. Jedi is not installed, falling back to readline Python shell history: /Users/simon/.pythonhistory >>> import webbrowser Traceback (most recent call last): File "", line 1, in File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/webbrowser.py", line 669, in cmd = _synthesize(cmdline, -1) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/webbrowser.py", line 94, in _synthesize if controller and name.lower() == controller.basename: AttributeError: 'MacOSXOSAScript' object has no attribute 'basename' If I unset BROWSER then it works fine. The issue is that the MacOSXOSAScript class overrides BaseBrowser's init without redifining the basename attribute. So a simple fix is to remove the __init__ from MacOSXOSAScript (and I guess the same applies to the MacOSX class). The same issue applies to python 3.4 |
|
|
msg249317 - (view) |
Author: Simon Conseil (sconseil) * |
Date: 2015-08-29 10:17 |
New version of the patch to rename the _name attribute to name as in other BaseBrowser subclasses. |
|
|
msg257198 - (view) |
Author: Erwann Mest (_kud) |
Date: 2015-12-29 16:20 |
+1 I've got like 3 apps which are broken. - https://github.com/mkdocs/mkdocs/issues/465 - https://bugzilla.mozilla.org/show_bug.cgi?id=1012443 |
|
|
msg257962 - (view) |
Author: Senthil Kumaran (orsenthil) *  |
Date: 2016-01-11 14:52 |
The patch is correct and will fix the issue. It will require test coverage to be complete so that we don't land upon similar issues in future. |
|
|
msg258120 - (view) |
Author: Simon Conseil (sconseil) * |
Date: 2016-01-12 22:43 |
I have looked at the webbrowser tests and it seems not so easy: currently the MacOS browser classes are not tested, and they don't the GenericBrowser base class. Instead they use custom code with os.popen, so it would require some work either replace os.popen with subprocess.Popen, or to mock the os.popen calls. I'm not sure I will the time to dig into this. |
|
|
msg258122 - (view) |
Author: Senthil Kumaran (orsenthil) *  |
Date: 2016-01-12 23:43 |
Simon, sure. It is just for someone, either commiters or other interested folks to add the tests on top of your patch. Agree with you that more change is required to add the required tests. |
|
|
msg374220 - (view) |
Author: Hugo Delgado (hudelgado) * |
Date: 2020-07-25 02:19 |
I've bumped into this and won't mind working on it, is it ok for me to try to finish it? |
|
|
msg374221 - (view) |
Author: Senthil Kumaran (orsenthil) *  |
Date: 2020-07-25 02:26 |
Hugo, please go ahead and a test for this patch. |
|
|
msg374223 - (view) |
Author: Hugo Delgado (hudelgado) * |
Date: 2020-07-25 02:43 |
Ok, I'm thinking in also replace the os.popen calls with subprocess.Popen to keep consistency with existing tests. Do you think it's a good approach? Or should be better to just add some tests around the current implementation? |
|
|
msg374231 - (view) |
Author: Senthil Kumaran (orsenthil) *  |
Date: 2020-07-25 03:48 |
Hugo, I'd welcome such a change. |
|
|
msg374358 - (view) |
Author: Hugo Delgado (hudelgado) * |
Date: 2020-07-27 03:16 |
I took a look at it and have a some more questions. The class MacOSX(BaseBrowser) seems to be broken because it uses 'OpenUrl' which doesn't work in most recent versions of applescript, also that class doesn't seem to be used anywhere, is it ok to remove it, or should left it as is? Although that class isn't used it contained an hack to open local files that didn't exist in the class MacOSXOSAScript(BaseBrowser), i've added that hack to the MacOSXOSAScript. Can you validate if everything seems ok with this changes? I'm happy to adjust things according to what you suggest. |
|
|
msg399394 - (view) |
Author: Andrei Kulakov (andrei.avk) *  |
Date: 2021-08-11 13:59 |
Also see https://bugs.python.org/issue42255 Hugo: can you convert the patch to a PR? |
|
|
msg399488 - (view) |
Author: Hugo Delgado (hudelgado) * |
Date: 2021-08-13 01:52 |
Yes, I've created a PR for it. https://github.com/python/cpython/pull/27751 Happy to adapt it as needed. Thanks |
|
|