Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#23428 closed defect (fixed)

Jupyter doesn't start browser on OSX 10.12.5

Reported by: vbraun Owned by:
Priority: blocker Milestone: sage-8.1
Component: notebook Keywords:
Cc: Merged in:
Authors: Volker Braun Reviewers: John Palmieri
Report Upstream: N/A Work issues:
Branch: u/jhpalmieri/jupyter_doesn_t_start_browser_on_osx_10_12_5 Commit: 924458938ff332478801df830cc61175bc433d99
Dependencies: Stopgaps:

Status badges


The latest and greatest OSX has some Applescript braindamage that prevents it from opening a browser. Workaround is

export BROWSER=open


Change History (10)

comment:1 Changed 5 years ago by vbraun

  • Branch set to u/vbraun/jupyter_doesn_t_start_browser_on_osx_10_12_5

comment:2 Changed 5 years ago by vbraun

  • Authors set to Volker Braun
  • Commit set to 8c1678db81734c00a202cbc26e5034688f5db69a
  • Status changed from new to needs_review

New commits:

8c1678dOSX bug workaround for opening Jupyter browser

comment:3 Changed 5 years ago by jhpalmieri

I'd rather respect the value of BROWSER if it is set, and also add a little documentation:

  • src/bin/sage-notebook

    diff --git a/src/bin/sage-notebook b/src/bin/sage-notebook
    index 294097a893..99d59f4216 100755
    a b def make_parser(): 
    226226    return parser
    229 def trac_23428_workaround():
     229def trac_23428_browser_workaround():
     230    """
     231    Running 'sage -n" with the Jupyter notebook on Darwin fails to
     232    open a browser automatically. See :trac:`23428`.
     233    """
    230234    if sys.platform != 'darwin':
    231235        return
    232     os.environ['BROWSER'] = 'open'
     236    if not os.environ.get('BROWSER', False):
     237        os.environ['BROWSER'] = 'open'
    235240if __name__ == '__main__':
    if __name__ == '__main__': 
    237242    args, unknown = parser.parse_known_args(sys.argv[1:])
    238243    if len(unknown) > 0 and unknown[0] == '--':
    239244        unknown = unknown[1:]
    240     trac_23428_workaround()
     245    trac_23428_browser_workaround()
    241246    if args.log is not None:
    242247        import logging
    243248        level = getattr(logging, args.log.upper())

comment:4 Changed 5 years ago by jhpalmieri

This does fix the problem for me (which I've had for a while), by the way. If you approve my changes, I can change the branch if you want and then set it to positive review.

comment:5 Changed 5 years ago by vbraun

Sounds good to me

comment:6 Changed 5 years ago by jhpalmieri

  • Branch changed from u/vbraun/jupyter_doesn_t_start_browser_on_osx_10_12_5 to u/jhpalmieri/jupyter_doesn_t_start_browser_on_osx_10_12_5

comment:7 Changed 5 years ago by jhpalmieri

  • Commit changed from 8c1678db81734c00a202cbc26e5034688f5db69a to 924458938ff332478801df830cc61175bc433d99
  • Reviewers set to John Palmieri
  • Status changed from needs_review to positive_review

New commits:

9244589trac 23428: preserve value of BROWSER if set, add a little documentation

comment:8 follow-up: Changed 5 years ago by kcrisman

Nice fast work! Does Jeroen's SagenbExport? and Sagenb work normally with this as well? Sorry I can't test this as I don't have 10.12.

comment:9 Changed 5 years ago by vbraun

  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:10 in reply to: ↑ 8 Changed 5 years ago by jhpalmieri

Replying to kcrisman:

Nice fast work! Does Jeroen's SagenbExport? and Sagenb work normally with this as well?

Yes and yes.

Note: See TracTickets for help on using tickets.