Skip to content
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 · 124 comments
Closed

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

flrgsr opened this issue Apr 24, 2017 · 124 comments
Milestone

Comments

@flrgsr
Copy link

@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
Copy link
Member

@takluyver takluyver commented Apr 24, 2017

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

@flrgsr
Copy link
Author

@flrgsr flrgsr commented Apr 24, 2017

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

@takluyver
Copy link
Member

@takluyver takluyver commented Apr 24, 2017

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

@aryamccarthy
Copy link

@aryamccarthy aryamccarthy commented Apr 26, 2017

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

@pinglewang
Copy link

@pinglewang pinglewang commented Apr 26, 2017

same here with MacOS 10.12.5 Beta (16F67a)

@MReschenberg
Copy link

@MReschenberg MReschenberg commented Apr 27, 2017

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

@aryamccarthy
Copy link

@aryamccarthy aryamccarthy commented Apr 27, 2017

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

@takluyver
Copy link
Member

@takluyver takluyver commented Apr 27, 2017

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

@climbercarmich
Copy link

@climbercarmich 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
Copy link

@Vayne-Lover 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
Copy link

@BeatHubmann 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
Copy link

@ultimatist 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
Copy link

@kjprice kjprice commented May 8, 2017

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

@defjaf
Copy link

@defjaf 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
Copy link
Author

@flrgsr 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
Copy link

@azarezade azarezade commented May 16, 2017

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

@defjaf
Copy link

@defjaf 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
Copy link

@konstmish 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
Copy link

@defjaf 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
Copy link

@ansteam 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
Copy link

@adisuissa adisuissa commented May 16, 2017

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

@smartmyself
Copy link

@smartmyself smartmyself commented May 16, 2017

Same here after upgrading to 10.12.5

@smartmyself
Copy link

@smartmyself smartmyself commented May 16, 2017

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

@jcrotinger
Copy link

@jcrotinger 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
Copy link

@defjaf 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
Copy link

@bighomeyg bighomeyg commented May 16, 2017

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

@ghost
Copy link

@ghost ghost 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
Copy link

@fedecava fedecava commented May 17, 2017

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

@ijstokes
Copy link

@ijstokes 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.

@yalinanaliz
Copy link

@yalinanaliz 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
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
Copy link

@lancekrogers 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
Copy link

@zazazack 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
Copy link

@glyph 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
Copy link

@bighomeyg 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
Copy link

@glyph glyph commented Jul 19, 2017

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

@bighomeyg
Copy link

@bighomeyg 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
Copy link

@samkhan1 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
Copy link

@glyph glyph commented Jul 20, 2017

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

@defjaf
Copy link

@defjaf 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
Copy link

@lmarti 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
Copy link

@BigBubba 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
Copy link

@glyph glyph commented Jul 21, 2017

Update macOS. The bug is fixed :).

@bighomeyg
Copy link

@bighomeyg bighomeyg commented Jul 21, 2017

Can confirm upgrading to 10.12.6 fixes the issue.

@vietvudanh
Copy link

@vietvudanh vietvudanh commented Jul 22, 2017

Confirm 10.12.6 fixed that. Please closed this issue.

@takluyver
Copy link
Member

@takluyver 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
Copy link

@xk537 xk537 commented Aug 10, 2017

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

@SBNBON005
Copy link

@SBNBON005 SBNBON005 commented Aug 10, 2017

@rmcantin Your solution worked for me 👍

@glyph
Copy link

@glyph glyph commented Aug 10, 2017

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

@Clara-YR
Copy link

@Clara-YR Clara-YR commented Aug 18, 2017

open terminal in Mac
type jupyter 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.py to open the python file
find #c.NotebookApp.browser = u' '
and change it to c.NotebookApp.browser = u'Chrome '

@JontySinai
Copy link

@JontySinai 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
Copy link

@websemantics 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
Copy link

@ayunas 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
Copy link

@Gemesys 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).

@minrk minrk added this to the Reference milestone Sep 13, 2018
@ivancarrascoq
Copy link

@ivancarrascoq ivancarrascoq commented Feb 3, 2019

I am using Ubuntu, and for me worked with:
c.NotebookApp.browser = u'google-chrome'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.