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

execution error: doesn’t understand the “open location” message. (-1708) #2438

Closed
flrgsr opened this Issue Apr 24, 2017 · 123 comments

Comments

Projects
None yet
@flrgsr

flrgsr commented Apr 24, 2017

This error message appeared randomly today when I (as usually) tried to start a notebook via jupyter notebook

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Apr 24, 2017

Member

Did the error show up in a terminal, or somewhere else? What platform are you on?

Member

takluyver commented Apr 24, 2017

Did the error show up in a terminal, or somewhere else? What platform are you on?

@flrgsr

This comment has been minimized.

Show comment
Hide comment
@flrgsr

flrgsr Apr 24, 2017

Yep terminal (iTerm), platform is OS X and Browser Chrome.

flrgsr commented Apr 24, 2017

Yep terminal (iTerm), platform is OS X and Browser Chrome.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Apr 24, 2017

Member

OK, I'll leave it for the Mac users to help with that.

Member

takluyver commented Apr 24, 2017

OK, I'll leave it for the Mac users to help with that.

@aryamccarthy

This comment has been minimized.

Show comment
Hide comment
@aryamccarthy

aryamccarthy Apr 26, 2017

Same with built-in Terminal and Safari, macOS 10.12.5.

aryamccarthy commented Apr 26, 2017

Same with built-in Terminal and Safari, macOS 10.12.5.

@wangpingle413

This comment has been minimized.

Show comment
Hide comment
@wangpingle413

wangpingle413 Apr 26, 2017

same here with MacOS 10.12.5 Beta (16F67a)

wangpingle413 commented Apr 26, 2017

same here with MacOS 10.12.5 Beta (16F67a)

@MReschenberg

This comment has been minimized.

Show comment
Hide comment
@MReschenberg

MReschenberg Apr 27, 2017

Same here, built in Terminal and Google Chrome on Mac OS 10.12.5 (Beta 16F60a)

MReschenberg commented Apr 27, 2017

Same here, built in Terminal and Google Chrome on Mac OS 10.12.5 (Beta 16F60a)

@aryamccarthy

This comment has been minimized.

Show comment
Hide comment
@aryamccarthy

aryamccarthy Apr 27, 2017

@takluyver Where in the code base is this error thrown? That will help us to diagnose it.

aryamccarthy commented Apr 27, 2017

@takluyver Where in the code base is this error thrown? That will help us to diagnose it.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Apr 27, 2017

Member

That error is not something from our code, as far as I can see.

Member

takluyver commented Apr 27, 2017

That error is not something from our code, as far as I can see.

@climbercarmich

This comment has been minimized.

Show comment
Hide comment
@climbercarmich

climbercarmich Apr 27, 2017

Same here with Mac OS and Google Chrome Canary. Error:

0:97: execution error: "http://localhost:8888/tree?token=***" doesn’t understand the “open location” message. (-1708)

climbercarmich commented Apr 27, 2017

Same here with Mac OS and Google Chrome Canary. Error:

0:97: execution error: "http://localhost:8888/tree?token=***" doesn’t understand the “open location” message. (-1708)

@Vayne-Lover

This comment has been minimized.

Show comment
Hide comment
@Vayne-Lover

Vayne-Lover May 3, 2017

Same here with macOS and Chrome.Error:

0:97: execution error: "http://localhost:8888/tree?    
token=c9c72f63d8482d80ee7dfd7aacc70c5d3048b6a7626b2859" doesn’t understand the “open location” message. (-1708)

Vayne-Lover commented May 3, 2017

Same here with macOS and Chrome.Error:

0:97: execution error: "http://localhost:8888/tree?    
token=c9c72f63d8482d80ee7dfd7aacc70c5d3048b6a7626b2859" doesn’t understand the “open location” message. (-1708)
@BeatHubmann

This comment has been minimized.

Show comment
Hide comment
@BeatHubmann

BeatHubmann May 3, 2017

This is an Apple event error: "The script doesn’t understand the message. The event was not handled." AppleScript documentation:
https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_error_codes.html
I guess this was caused by recent changes in the latest MacOS revision.
The 'open location' call run by Jupyter would need to be adapted; meanwhile setting c.NotebookApp.open_browser = False in your jupyter_notebook_config.py and manually copying the NB link helps if one finds the error message annoying.

BeatHubmann commented May 3, 2017

This is an Apple event error: "The script doesn’t understand the message. The event was not handled." AppleScript documentation:
https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_error_codes.html
I guess this was caused by recent changes in the latest MacOS revision.
The 'open location' call run by Jupyter would need to be adapted; meanwhile setting c.NotebookApp.open_browser = False in your jupyter_notebook_config.py and manually copying the NB link helps if one finds the error message annoying.

@ultimatist

This comment has been minimized.

Show comment
Hide comment
@ultimatist

ultimatist May 4, 2017

Same issue, latest OS X, looks like a Mac-side problem. Copy/paste link in browser works every time.

ultimatist commented May 4, 2017

Same issue, latest OS X, looks like a Mac-side problem. Copy/paste link in browser works every time.

@kjprice

This comment has been minimized.

Show comment
Hide comment
@kjprice

kjprice May 8, 2017

Ignore the error. Go to http://localhost:8888/tree directly, in your browser.

kjprice commented May 8, 2017

Ignore the error. Go to http://localhost:8888/tree directly, in your browser.

@defjaf

This comment has been minimized.

Show comment
Hide comment
@defjaf

defjaf May 16, 2017

For me, this seems to have started with the upgrade to 10.12.5, which dropped on 15 May. But this thread appeared earlier: can anyone who saw this earlier confirm whether they were on the macOS beta?

(Also, this is clearly a bug, even if it's generated OS-side: "Ignore the error" is only the best solution if it's not fixable...)

defjaf commented May 16, 2017

For me, this seems to have started with the upgrade to 10.12.5, which dropped on 15 May. But this thread appeared earlier: can anyone who saw this earlier confirm whether they were on the macOS beta?

(Also, this is clearly a bug, even if it's generated OS-side: "Ignore the error" is only the best solution if it's not fixable...)

@flrgsr

This comment has been minimized.

Show comment
Hide comment
@flrgsr

flrgsr May 16, 2017

I was on the beta version when the bug first appeared, don't know which version tough as there were updates since then.

flrgsr commented May 16, 2017

I was on the beta version when the bug first appeared, don't know which version tough as there were updates since then.

@azarezade

This comment has been minimized.

Show comment
Hide comment
@azarezade

azarezade May 16, 2017

Same for me just after upgrade to 10.12.5.
However, the link works.

azarezade commented May 16, 2017

Same for me just after upgrade to 10.12.5.
However, the link works.

@defjaf

This comment has been minimized.

Show comment
Hide comment
@defjaf

defjaf May 16, 2017

For what it's worth, the release notes to macOS 10.12.5 and Safari 10.1.1 don't appear to have anything listed that would result in this (but my ability to read and understand the security update information is limited).

Also, I just checked in the AppleScript editor, and both Safari and Chrome do understand the "open location http://what.ev.er/" message -- but I note that the error message is the "reverse" of this:

0:97: execution error: "http://localhost:8888/tree?token=<removed>" doesn’t understand the “open location” message. (-1708)

I suppose it's worth a look in the jupyter code to see how this actually gets done...

defjaf commented May 16, 2017

For what it's worth, the release notes to macOS 10.12.5 and Safari 10.1.1 don't appear to have anything listed that would result in this (but my ability to read and understand the security update information is limited).

Also, I just checked in the AppleScript editor, and both Safari and Chrome do understand the "open location http://what.ev.er/" message -- but I note that the error message is the "reverse" of this:

0:97: execution error: "http://localhost:8888/tree?token=<removed>" doesn’t understand the “open location” message. (-1708)

I suppose it's worth a look in the jupyter code to see how this actually gets done...

@konstmish

This comment has been minimized.

Show comment
Hide comment
@konstmish

konstmish May 16, 2017

Restarted my laptop to update the system and got this error. Going directly to http://localhost:8888/tree, as kjprice suggests, helps in my case.

konstmish commented May 16, 2017

Restarted my laptop to update the system and got this error. Going directly to http://localhost:8888/tree, as kjprice suggests, helps in my case.

@defjaf

This comment has been minimized.

Show comment
Hide comment
@defjaf

defjaf May 16, 2017

(Solution at bottom!)

So it seems that the problem is in the Python standard library, and I suppose with its interaction with the macOS update:

In [2]: import webbrowser
In [3]: browser=webbrowser.get(None)
In [4]: browser.open("http://python.org")
   0:33: execution error: "http://python.org" doesn’t understand the “open location” message. (-1708)
Out[4]: False

(same behaviour with Python 2 or 3)

However, browser=webbrowser.get("Safari") works!

So, the solution is to explicitly set the browser in ~/.jupyter/jupyter_notebook_config.py (updated from stupidly incorrect file location):

c.NotebookApp.browser = u'Safari'

defjaf commented May 16, 2017

(Solution at bottom!)

So it seems that the problem is in the Python standard library, and I suppose with its interaction with the macOS update:

In [2]: import webbrowser
In [3]: browser=webbrowser.get(None)
In [4]: browser.open("http://python.org")
   0:33: execution error: "http://python.org" doesn’t understand the “open location” message. (-1708)
Out[4]: False

(same behaviour with Python 2 or 3)

However, browser=webbrowser.get("Safari") works!

So, the solution is to explicitly set the browser in ~/.jupyter/jupyter_notebook_config.py (updated from stupidly incorrect file location):

c.NotebookApp.browser = u'Safari'
@ansteam

This comment has been minimized.

Show comment
Hide comment
@ansteam

ansteam May 16, 2017

Same here, the error occurs just after macOS 10.12.5 update (Safari 10.1.1).

I'm using Jupyter from Anaconda's distribution and defjaf's solution
(c.NotebookApp.browser = u'Safari' in ~/.jupyter_notebook_config.py)
doesn't seem to work for me.
I tried to put there another option (c.NotebookApp.open_browser = False) just to avoid the message, but no success either. Looks like the config file is being ignored.
Any hints?

ansteam commented May 16, 2017

Same here, the error occurs just after macOS 10.12.5 update (Safari 10.1.1).

I'm using Jupyter from Anaconda's distribution and defjaf's solution
(c.NotebookApp.browser = u'Safari' in ~/.jupyter_notebook_config.py)
doesn't seem to work for me.
I tried to put there another option (c.NotebookApp.open_browser = False) just to avoid the message, but no success either. Looks like the config file is being ignored.
Any hints?

@adisuissa

This comment has been minimized.

Show comment
Hide comment
@adisuissa

adisuissa May 16, 2017

@ansteam: try saving it in ~/.jupyter/jupyter_notebook_config.py

adisuissa commented May 16, 2017

@ansteam: try saving it in ~/.jupyter/jupyter_notebook_config.py

@smartmyself

This comment has been minimized.

Show comment
Hide comment
@smartmyself

smartmyself May 16, 2017

Same here after upgrading to 10.12.5

smartmyself commented May 16, 2017

Same here after upgrading to 10.12.5

@smartmyself

This comment has been minimized.

Show comment
Hide comment
@smartmyself

smartmyself May 16, 2017

@defjaf Hey Andrew, thanks for your solution, it works!

smartmyself commented May 16, 2017

@defjaf Hey Andrew, thanks for your solution, it works!

@jcrotinger

This comment has been minimized.

Show comment
Hide comment
@jcrotinger

jcrotinger May 16, 2017

I tried

c.NotebookApp.browser = u'Google Chrome'

But got

[W 12:19:50.134 NotebookApp] No web browser found: could not locate runnable browser.

(Also tried 'Chrome' with the same results.)

What do I need to do to have it launch Chrome?

jcrotinger commented May 16, 2017

I tried

c.NotebookApp.browser = u'Google Chrome'

But got

[W 12:19:50.134 NotebookApp] No web browser found: could not locate runnable browser.

(Also tried 'Chrome' with the same results.)

What do I need to do to have it launch Chrome?

@defjaf

This comment has been minimized.

Show comment
Hide comment
@defjaf

defjaf May 16, 2017

@jcrotinger, according to this Python bug report and fix, it looks like the Chrome problem should be fixed in the next update to all maintained python builds...

defjaf commented May 16, 2017

@jcrotinger, according to this Python bug report and fix, it looks like the Chrome problem should be fixed in the next update to all maintained python builds...

@bighomeyg

This comment has been minimized.

Show comment
Hide comment
@bighomeyg

bighomeyg May 16, 2017

@jcrotinger: c.NotebookApp.browser = u'chrome' should do the trick.

bighomeyg commented May 16, 2017

@jcrotinger: c.NotebookApp.browser = u'chrome' should do the trick.

@davidjaimes

This comment has been minimized.

Show comment
Hide comment
@davidjaimes

davidjaimes May 17, 2017

@defjaf: Thanks Andrew for the Safari browser help!

Here the command to create ~/.jupyter_notebook_config.py if it does not exist:

jupyter notebook --generate-config

davidjaimes commented May 17, 2017

@defjaf: Thanks Andrew for the Safari browser help!

Here the command to create ~/.jupyter_notebook_config.py if it does not exist:

jupyter notebook --generate-config
@fedecava

This comment has been minimized.

Show comment
Hide comment
@fedecava

fedecava May 17, 2017

c.NotebookApp.browser = u'chrome' worked for me!

fedecava commented May 17, 2017

c.NotebookApp.browser = u'chrome' worked for me!

@ijstokes

This comment has been minimized.

Show comment
Hide comment
@ijstokes

ijstokes May 17, 2017

@defjaf and @bighomeyg thanks for those steps: solved it for me (after I remembered to also uncomment the config line!). Problem cropped up when I upgraded just now to macOS 10.12.5.

ijstokes commented May 17, 2017

@defjaf and @bighomeyg thanks for those steps: solved it for me (after I remembered to also uncomment the config line!). Problem cropped up when I upgraded just now to macOS 10.12.5.

@mrdivine

This comment has been minimized.

Show comment
Hide comment
@mrdivine

mrdivine May 17, 2017

@defjaf and @davidjaimes the combination of the two solutions worked for me. Thanks!

mrdivine commented May 17, 2017

@defjaf and @davidjaimes the combination of the two solutions worked for me. Thanks!

@defjaf

This comment has been minimized.

Show comment
Hide comment
@defjaf

defjaf May 17, 2017

Let's also remember that there is still possibly a bug here: the expectation is that jupyter should use the default browser when c.NotebookApp.browser is unset (as used to be the behaviour). Not clear whether this is a python bug, a macOS bug, or a security feature... but it doesn't appear to be something specific to jupyter since webbrowser.get().open("http://python.org") fails in python with exactly the error that we all saw.

defjaf commented May 17, 2017

Let's also remember that there is still possibly a bug here: the expectation is that jupyter should use the default browser when c.NotebookApp.browser is unset (as used to be the behaviour). Not clear whether this is a python bug, a macOS bug, or a security feature... but it doesn't appear to be something specific to jupyter since webbrowser.get().open("http://python.org") fails in python with exactly the error that we all saw.

@rmcantin

This comment has been minimized.

Show comment
Hide comment
@rmcantin

rmcantin May 17, 2017

An alternative workaround is to set the BROWSER environment variable.

For example:
export BROWSER=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome

rmcantin commented May 17, 2017

An alternative workaround is to set the BROWSER environment variable.

For example:
export BROWSER=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome

@andrewjmacrae

This comment has been minimized.

Show comment
Hide comment
@andrewjmacrae

andrewjmacrae May 17, 2017

Upon @rmcantin 's suggestion, editing my ~/.bash_profile file to contain the lines:

BROWSER=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
export BROWSER

worked for me (c.NotebookApp.browser = u'chrome', did not for whatever reason)

andrewjmacrae commented May 17, 2017

Upon @rmcantin 's suggestion, editing my ~/.bash_profile file to contain the lines:

BROWSER=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
export BROWSER

worked for me (c.NotebookApp.browser = u'chrome', did not for whatever reason)

@defjaf

This comment has been minimized.

Show comment
Hide comment
@defjaf

defjaf May 17, 2017

Reported on the Python bug tracker as http://bugs.python.org/issue30392

defjaf commented May 17, 2017

Reported on the Python bug tracker as http://bugs.python.org/issue30392

@enelson1995

This comment has been minimized.

Show comment
Hide comment
@enelson1995

enelson1995 May 17, 2017

@ andrewjmacrae - your solution worked for me! Thanks

enelson1995 commented May 17, 2017

@ andrewjmacrae - your solution worked for me! Thanks

@zqfzera

This comment has been minimized.

Show comment
Hide comment
@zqfzera

zqfzera May 18, 2017

@ andrewjmacrae 你的方法有效,谢谢!

zqfzera commented May 18, 2017

@ andrewjmacrae 你的方法有效,谢谢!

@mjspeck

This comment has been minimized.

Show comment
Hide comment
@mjspeck

mjspeck May 18, 2017

As a side note, the 10.12.5 screwed up a lot of my opens. When I tried to open markdown files using open markdown_file.md it tried to open it using RStudio (it should have used sublime). So I'm inclined to think this is a MacOS bug, not a python one.

mjspeck commented May 18, 2017

As a side note, the 10.12.5 screwed up a lot of my opens. When I tried to open markdown files using open markdown_file.md it tried to open it using RStudio (it should have used sublime). So I'm inclined to think this is a MacOS bug, not a python one.

@hanshenry90

This comment has been minimized.

Show comment
Hide comment
@hanshenry90

hanshenry90 commented May 18, 2017

@andrewjmacrae it worked! Thanks!

@arrudadfa

This comment has been minimized.

Show comment
Hide comment
@arrudadfa

arrudadfa May 19, 2017

Guys,

  1. Create "jupyter_notebook_config.py"
  2. Write the following routine inside:

import webbrowser
browser=webbrowser.get("Safari")
browser.open("http://localhost:8888/tree")

  1. save it on path ~/.jupyter (command+shift+G)

Good luck!

arrudadfa commented May 19, 2017

Guys,

  1. Create "jupyter_notebook_config.py"
  2. Write the following routine inside:

import webbrowser
browser=webbrowser.get("Safari")
browser.open("http://localhost:8888/tree")

  1. save it on path ~/.jupyter (command+shift+G)

Good luck!

@wendingp

This comment has been minimized.

Show comment
Hide comment
@weiwongfaye

This comment has been minimized.

Show comment
Hide comment
@weiwongfaye

weiwongfaye Jul 8, 2017

@lmarti 's solution works for me on mac 10.12.5
$ export BROWSER=open

weiwongfaye commented Jul 8, 2017

@lmarti 's solution works for me on mac 10.12.5
$ export BROWSER=open

@yalinanaliz

This comment has been minimized.

Show comment
Hide comment
@yalinanaliz

yalinanaliz Jul 14, 2017

In the terminal window while you are home directory do these:

  • cd .jupyter
  • vi jupyter_notebook_config.py (It opens the config file in vi editor)
  • find the line c.Notebook.browser = ' '
  • change the c.Notebook.browser = u'chrome' (to change it in edit mode press 'i' letter)
  • delete # at the beginning of the line
  • press esc
  • enter :wq to save and exit the file

yalinanaliz commented Jul 14, 2017

In the terminal window while you are home directory do these:

  • cd .jupyter
  • vi jupyter_notebook_config.py (It opens the config file in vi editor)
  • find the line c.Notebook.browser = ' '
  • change the c.Notebook.browser = u'chrome' (to change it in edit mode press 'i' letter)
  • delete # at the beginning of the line
  • press esc
  • enter :wq to save and exit the file

sageb0t pushed a commit to sagemath/sage that referenced this issue Jul 14, 2017

Trac #23428: Jupyter doesn't start browser on OSX 10.12.5
The latest and greatest OSX has some Applescript braindamage that
prevents it from opening a browser. Workaround is
{{{
export BROWSER=open
}}}
Links:
* Radar 31898264
* jupyter/notebook#2438
* http://bugs.python.org/issue30392

URL: https://trac.sagemath.org/23428
Reported by: vbraun
Ticket author(s): Volker Braun
Reviewer(s): John Palmieri
@lancekrogers

This comment has been minimized.

Show comment
Hide comment
@lancekrogers

lancekrogers Jul 17, 2017

@lmarti's solution below works for me, make sure to add it to your .bash_profile so you won't have to run it every time you want to open a notebook.

export BROWSER=open

lancekrogers commented Jul 17, 2017

@lmarti's solution below works for me, make sure to add it to your .bash_profile so you won't have to run it every time you want to open a notebook.

export BROWSER=open

@zazazack

This comment has been minimized.

Show comment
Hide comment
@zazazack

zazazack Jul 17, 2017

🤔 I noticed I only started seeing this error after I changed my default browser from safari to chrome. @lmarti @lancekrogers export BROWSER=open worked for me as well.

zazazack commented Jul 17, 2017

🤔 I noticed I only started seeing this error after I changed my default browser from safari to chrome. @lmarti @lancekrogers export BROWSER=open worked for me as well.

@glyph

This comment has been minimized.

Show comment
Hide comment
@glyph

glyph Jul 17, 2017

Be aware that export BROWSER=open will potentially let Python applications which think they're opening an URL in a "web browser" actually open and potentially run any application or program on your computer, so this isn't really a safe way to address this problem.

glyph commented Jul 17, 2017

Be aware that export BROWSER=open will potentially let Python applications which think they're opening an URL in a "web browser" actually open and potentially run any application or program on your computer, so this isn't really a safe way to address this problem.

@bighomeyg

This comment has been minimized.

Show comment
Hide comment
@bighomeyg

bighomeyg Jul 19, 2017

Welp, I'm getting a new error as a result of my chrome solution posted above: c.NotebookApp.browser = u'chrome' seems to be resulting in the following error:

execution error: Can’t get application "chrome". (-1728). For anyone experiencing this, I've found two workarounds to avoid this error:
1). Open chrome first, and then launch jupyter from the command line (works just fine!), or
2). Switch to Safari with c.NotebookApp.browser = u'Safari'.
I'm opting for Safari, but curious if anyone finds any Chrome solutions that don't include export BROWSER=open which, as @glyph explains, is pretty dangerous.

bighomeyg commented Jul 19, 2017

Welp, I'm getting a new error as a result of my chrome solution posted above: c.NotebookApp.browser = u'chrome' seems to be resulting in the following error:

execution error: Can’t get application "chrome". (-1728). For anyone experiencing this, I've found two workarounds to avoid this error:
1). Open chrome first, and then launch jupyter from the command line (works just fine!), or
2). Switch to Safari with c.NotebookApp.browser = u'Safari'.
I'm opting for Safari, but curious if anyone finds any Chrome solutions that don't include export BROWSER=open which, as @glyph explains, is pretty dangerous.

@glyph

This comment has been minimized.

Show comment
Hide comment
@glyph

glyph Jul 19, 2017

Have you tried u"Google Chrome"? That's the literal name of the app bundle, I believe.

glyph commented Jul 19, 2017

Have you tried u"Google Chrome"? That's the literal name of the app bundle, I believe.

@bighomeyg

This comment has been minimized.

Show comment
Hide comment
@bighomeyg

bighomeyg Jul 19, 2017

I did--it results in a No web browser found: could not locate runnable browser error. u'chrome' is the only chrome/Google Chrome/Google Chrome combination that would work for me.

bighomeyg commented Jul 19, 2017

I did--it results in a No web browser found: could not locate runnable browser error. u'chrome' is the only chrome/Google Chrome/Google Chrome combination that would work for me.

@samkhan1

This comment has been minimized.

Show comment
Hide comment
@samkhan1

samkhan1 Jul 19, 2017

currently experiencing this bug after updating Mac OSX to 10.12.5

c.NotebookApp.browser = u'Safari' worked but c9.io gave me an error about Sockets not working properly in Safari 10.1 and suggested that I use Chrome.

these combinations did not work: u'chrome', u'Chrome', u'Google Chrome' and u'Google\ Chrome'

This finally worked:
c.NotebookApp.browser = u'open -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %s'

thanks @tlwillke and @haccks for solution.

samkhan1 commented Jul 19, 2017

currently experiencing this bug after updating Mac OSX to 10.12.5

c.NotebookApp.browser = u'Safari' worked but c9.io gave me an error about Sockets not working properly in Safari 10.1 and suggested that I use Chrome.

these combinations did not work: u'chrome', u'Chrome', u'Google Chrome' and u'Google\ Chrome'

This finally worked:
c.NotebookApp.browser = u'open -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %s'

thanks @tlwillke and @haccks for solution.

@glyph

This comment has been minimized.

Show comment
Hide comment
@glyph

glyph Jul 20, 2017

Is that "%s" being literally interpolated or is it being shell-quoted somehow?

glyph commented Jul 20, 2017

Is that "%s" being literally interpolated or is it being shell-quoted somehow?

@defjaf

This comment has been minimized.

Show comment
Hide comment
@defjaf

defjaf Jul 20, 2017

macOS 10.12.6 is out and so the underlying osascript bug is fixed (which means that jupyter should use the default browser; the separate problem of specifying Chrome for c.NotebookApp.browser may still exist if you want to specify it in ~/.jupyter/jupyter_notebook_config.py.

defjaf commented Jul 20, 2017

macOS 10.12.6 is out and so the underlying osascript bug is fixed (which means that jupyter should use the default browser; the separate problem of specifying Chrome for c.NotebookApp.browser may still exist if you want to specify it in ~/.jupyter/jupyter_notebook_config.py.

@lmarti

This comment has been minimized.

Show comment
Hide comment
@lmarti

lmarti Jul 20, 2017

@glyph ...yes but the other solutions can also be fooled by creating an application named 'Google Chrome' or 'Safari'. In any case, all approaches here are temporary solutions until the real bug is solved.

lmarti commented Jul 20, 2017

@glyph ...yes but the other solutions can also be fooled by creating an application named 'Google Chrome' or 'Safari'. In any case, all approaches here are temporary solutions until the real bug is solved.

@BigBubba

This comment has been minimized.

Show comment
Hide comment
@BigBubba

BigBubba Jul 20, 2017

If you're still dealing with this issue, the 10.12.15 system python doesn't like any solution other than (for chrome, insert path to your browser bundle for something else):

c.NotebookApp.browser = u'open -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %s'

If you install either python2 or python3 via brew then setting c.NotebookApp.browser to 'chrome' will work with or without the unicode decorator so:

c.NotebookApp.browser = 'chrome'

or

c.NotebookApp.browser = u'chrome'

BigBubba commented Jul 20, 2017

If you're still dealing with this issue, the 10.12.15 system python doesn't like any solution other than (for chrome, insert path to your browser bundle for something else):

c.NotebookApp.browser = u'open -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %s'

If you install either python2 or python3 via brew then setting c.NotebookApp.browser to 'chrome' will work with or without the unicode decorator so:

c.NotebookApp.browser = 'chrome'

or

c.NotebookApp.browser = u'chrome'

@glyph

This comment has been minimized.

Show comment
Hide comment
@glyph

glyph Jul 21, 2017

Update macOS. The bug is fixed :).

glyph commented Jul 21, 2017

Update macOS. The bug is fixed :).

@bighomeyg

This comment has been minimized.

Show comment
Hide comment
@bighomeyg

bighomeyg Jul 21, 2017

Can confirm upgrading to 10.12.6 fixes the issue.

bighomeyg commented Jul 21, 2017

Can confirm upgrading to 10.12.6 fixes the issue.

@vietvudanh

This comment has been minimized.

Show comment
Hide comment
@vietvudanh

vietvudanh Jul 22, 2017

Confirm 10.12.6 fixed that. Please closed this issue.

vietvudanh commented Jul 22, 2017

Confirm 10.12.6 fixed that. Please closed this issue.

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Jul 25, 2017

Member

Thanks all. Please open a new issue if you see a similar problem with OSX 10.12.6 or newer.

Member

takluyver commented Jul 25, 2017

Thanks all. Please open a new issue if you see a similar problem with OSX 10.12.6 or newer.

@takluyver takluyver closed this Jul 25, 2017

@xk537

This comment has been minimized.

Show comment
Hide comment
@xk537

xk537 Aug 10, 2017

Thanks to @rmcantin . Your solution helps me.
export BROWSER=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome

xk537 commented Aug 10, 2017

Thanks to @rmcantin . Your solution helps me.
export BROWSER=/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome

@SBNBON005

This comment has been minimized.

Show comment
Hide comment
@SBNBON005

SBNBON005 Aug 10, 2017

@rmcantin Your solution worked for me 👍

SBNBON005 commented Aug 10, 2017

@rmcantin Your solution worked for me 👍

@glyph

This comment has been minimized.

Show comment
Hide comment
@glyph

glyph Aug 10, 2017

Please do not use @rmcantin's solution 😢 . Upgrade macOS.

glyph commented Aug 10, 2017

Please do not use @rmcantin's solution 😢 . Upgrade macOS.

@Clara-YR

This comment has been minimized.

Show comment
Hide comment
@Clara-YR

Clara-YR Aug 18, 2017

open terminal in Mac
typejupyter notebook --generate-config
the output is similar to
Writing default config to: /Users/User_name/.jupyter/jupyter_notebook_config.py
then type open /Users/User_name/.jupyter/jupyter_notebook_config.pyto open the python file
find #c.NotebookApp.browser = u' '
and change it to c.NotebookApp.browser = u'Chrome '

Clara-YR commented Aug 18, 2017

open terminal in Mac
typejupyter notebook --generate-config
the output is similar to
Writing default config to: /Users/User_name/.jupyter/jupyter_notebook_config.py
then type open /Users/User_name/.jupyter/jupyter_notebook_config.pyto open the python file
find #c.NotebookApp.browser = u' '
and change it to c.NotebookApp.browser = u'Chrome '

@JontySinai

This comment has been minimized.

Show comment
Hide comment
@JontySinai

JontySinai Aug 27, 2017

In addition to the instructions from @Clara-YR you also need to uncomment the line c.NotebookApp.browser = u'Safari'.

Here are clear instructions: https://stackoverflow.com/questions/44057601/ipython-notebook-will-not-start-on-command-line

JontySinai commented Aug 27, 2017

In addition to the instructions from @Clara-YR you also need to uncomment the line c.NotebookApp.browser = u'Safari'.

Here are clear instructions: https://stackoverflow.com/questions/44057601/ipython-notebook-will-not-start-on-command-line

@websemantics

This comment has been minimized.

Show comment
Hide comment
@websemantics

websemantics Oct 6, 2017

For Opera users, this worked for me,

c.NotebookApp.browser = u'open -a Opera %s'

Also, for other browsers / flavours, this link might be helpful

Thanks all,

websemantics commented Oct 6, 2017

For Opera users, this worked for me,

c.NotebookApp.browser = u'open -a Opera %s'

Also, for other browsers / flavours, this link might be helpful

Thanks all,

@ayunas

This comment has been minimized.

Show comment
Hide comment
@ayunas

ayunas Oct 10, 2017

@arrudadfa Thanks so much. creating the config file did the trick. After safari opened up, I had to fetch the token for the jupyter notebook, by typing in the command in terminal: "jupyter notebook list" . Safari required that token to load the jupyter notebook. I also appreciate the shortcut "command-shift-g" to open up a specific path to save the file in for the save as dialog. Very useful. Thanks again!
safari jupyter notebook token

ayunas commented Oct 10, 2017

@arrudadfa Thanks so much. creating the config file did the trick. After safari opened up, I had to fetch the token for the jupyter notebook, by typing in the command in terminal: "jupyter notebook list" . Safari required that token to load the jupyter notebook. I also appreciate the shortcut "command-shift-g" to open up a specific path to save the file in for the save as dialog. Very useful. Thanks again!
safari jupyter notebook token

@Gemesys

This comment has been minimized.

Show comment
Hide comment
@Gemesys

Gemesys Dec 5, 2017

I've just built a Jupyter/IPython Notebook environment on some older Linux machines, and I was having trouble getting one laptop to launch the webbrowser correctly. I run Gnome desktop and spent a long time messing about with glib and gtk+, putting the pkgconfig .pc files into /usr/lib/pkgconfig to make sure Firefox would find the right libs when it started, etc. But I still I kept getting the Jupyter authentication token being displayed when I ran "jupyter notebook", and an error saying that Jupyter could not launch the browser. I would have to start Firefox, enter "localhost:8888" as a url, and copy the long Jupyter authentication token into the password field to let Firefox access the localhost:8888 url. It's not supposed to work this way. When you enter "jupyter notebook" at term shell, the browser should just fire up, and you should see a web-page showing your directory tree you launched from.

The fix turned out to be simple. I just had to start the Firefox browser from the Gnome/Xwindows desktop, and click the button in Firefox to set Firefox as the default browser. You can then close the browser. Once that was done, you can just start a term shell, enter "jupyter notebook", and Jupyter starts and invokes the browser correctly with the authentication token, and you should see your directory tree that you launched from in the intial Jupyter webpage. This works on my older Fedora Linux platforms, and also on a CentOS box (ver. 6.6, running Gnome 2.28.2, Firefox 31.1 ESR).

Gemesys commented Dec 5, 2017

I've just built a Jupyter/IPython Notebook environment on some older Linux machines, and I was having trouble getting one laptop to launch the webbrowser correctly. I run Gnome desktop and spent a long time messing about with glib and gtk+, putting the pkgconfig .pc files into /usr/lib/pkgconfig to make sure Firefox would find the right libs when it started, etc. But I still I kept getting the Jupyter authentication token being displayed when I ran "jupyter notebook", and an error saying that Jupyter could not launch the browser. I would have to start Firefox, enter "localhost:8888" as a url, and copy the long Jupyter authentication token into the password field to let Firefox access the localhost:8888 url. It's not supposed to work this way. When you enter "jupyter notebook" at term shell, the browser should just fire up, and you should see a web-page showing your directory tree you launched from.

The fix turned out to be simple. I just had to start the Firefox browser from the Gnome/Xwindows desktop, and click the button in Firefox to set Firefox as the default browser. You can then close the browser. Once that was done, you can just start a term shell, enter "jupyter notebook", and Jupyter starts and invokes the browser correctly with the authentication token, and you should see your directory tree that you launched from in the intial Jupyter webpage. This works on my older Fedora Linux platforms, and also on a CentOS box (ver. 6.6, running Gnome 2.28.2, Firefox 31.1 ESR).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment