FS#59567 - [python] webbrowser module is broken when using $BROWSER

Attached to Project: Arch Linux
Opened by Guido Masella (gdmsl) - Wednesday, 08 August 2018, 13:40 GMT
Last edited by Toolybird (Toolybird) - Saturday, 21 January 2023, 21:54 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Felix Yan (felixonmars)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 4
Private No

Details

Description:

Jupyter notebook does not start after updating python (3.6.6-1 -> 3.7.0-3)

Additional info:

jupyter 4.1.0-6
jupyter-notebook 5.3.0-4
python-tornado 5.1.0-1

Steps to reproduce:

try to start jupyter notebook with jupyter notebook
This task depends upon

Closed by  Toolybird (Toolybird)
Saturday, 21 January 2023, 21:54 GMT
Reason for closing:  Fixed
Additional comments about closing:  @duthils says "Unreproducible with latest version"
Comment by Guido Masella (gdmsl) - Wednesday, 08 August 2018, 16:27 GMT
  • Field changed: Percent Complete (100% → 0%)
I don't think  FS#59535  is related. I just found out that running `jupyter notebook --no-borwser` will successfully start jupyter notebook. Probably it is due to a bug somewere in /usr/lib/python3.7/webbrowser.py . Is that possible? If I try to call webbrowser.get() from a python script I get the same error.
Comment by Doug Newgard (Scimmia) - Wednesday, 08 August 2018, 16:28 GMT
I don't.

Python 3.7.0 (default, Jul 15 2018, 10:44:58)
[GCC 8.1.1 20180531] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import webbrowser
>>> webbrowser.get()
<webbrowser.Chrome object at 0x7f2f2e45e7f0>
>>> print(webbrowser.__file__)
/usr/lib/python3.7/webbrowser.py
>>>
Comment by Eli Schwartz (eschwartz) - Wednesday, 08 August 2018, 16:48 GMT
Hmm, did not notice the error message was different. But if this is just running `jupyter notebook` then that works fine for me and even opens up the browser just fine.
Comment by Felix (darkthorn) - Thursday, 09 August 2018, 09:13 GMT
I can confirm this problem: Running "jupyter notebook" fails for me with the same error as in the notebook.log attached to this bug report.

Though I'd say, that it's not just Jupyter related, but more or less an issue of python itself:

$ python
Python 3.7.0 (default, Jul 15 2018, 10:44:58)
[GCC 8.1.1 20180531] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import webbrowser
>>> webbrowser.get()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/webbrowser.py", line 42, in get
register_standard_browsers()
File "/usr/lib/python3.7/webbrowser.py", line 567, in register_standard_browsers
cmd = _synthesize(cmdline, -1)
File "/usr/lib/python3.7/webbrowser.py", line 116, in _synthesize
register(browser, None, controller, update_tryorder)
TypeError: register() takes from 2 to 3 positional arguments but 4 were given
>>> print(webbrowser.__file__)
/usr/lib/python3.7/webbrowser.py
>>>
Comment by Guido Masella (gdmsl) - Thursday, 09 August 2018, 09:25 GMT
I have the same problem as Felix from python.

$ sudo pacman -Qo /usr/lib/python3.7/webbrowser.py
/usr/lib/python3.7/webbrowser.py is owned by python 3.7.0-3
Comment by Eli Schwartz (eschwartz) - Thursday, 09 August 2018, 23:58 GMT
  • Field changed: Attached to Project (Community Packages → Arch Linux)
  • Field changed: Summary ([jupyter] jupyter notebook not starting → [python] webbrowser module is broken when using $BROWSER)
  • Task reassigned to Felix Yan (felixonmars)
https://bugs.python.org/issue31014

Upstream fix: https://github.com/python/cpython/pull/7267

This has also been backported to the python 3.7 stable branch: https://github.com/python/cpython/pull/8183

The cause is that the _synthesize() function in the stdlib "webbrowser" module, which parses $BROWSER, was not included in a refactoring that broke things internally as a result. If you don't use $BROWSER then everything just works.
Comment by Sebastien Duthil (duthils) - Saturday, 21 January 2023, 21:40 GMT
I can't reproduce the issue with the latest python 3.10.9-1 and jupyter-notebook 6.5.2-1: running "jupyter notebook" starts the browser just fine, even when using $BROWSER. I guess this issue can be closed.

Loading...