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

Comments

@flrgsr
Copy link

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

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

@flrgsr
Copy link
Author

flrgsr commented Apr 24, 2017

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

@takluyver
Copy link
Member

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

@aryamccarthy
Copy link

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

@pinglewang
Copy link

same here with MacOS 10.12.5 Beta (16F67a)

@MReschenberg
Copy link

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

@aryamccarthy
Copy link

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

@takluyver
Copy link
Member

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

@climbercarmich
Copy link

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

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

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

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

@kjprice
Copy link

kjprice commented May 8, 2017

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

@defjaf
Copy link

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 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 commented May 16, 2017

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

@defjaf
Copy link

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

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 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 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

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

@smartmyself
Copy link

Same here after upgrading to 10.12.5

@smartmyself
Copy link

smartmyself commented May 16, 2017

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

@jcrotinger
Copy link

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 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

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

@ghost
Copy link

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

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

@ijstokes
Copy link

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

sageb0t pushed a commit to sagemath/sage-archive-2023-02-01 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

@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

🤔 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 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 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 commented Jul 19, 2017

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

@bighomeyg
Copy link

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 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 commented Jul 20, 2017

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

@defjaf
Copy link

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 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

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 commented Jul 21, 2017

Update macOS. The bug is fixed :).

@bighomeyg
Copy link

Can confirm upgrading to 10.12.6 fixes the issue.

@vietvudanh
Copy link

Confirm 10.12.6 fixed that. Please closed this issue.

@takluyver
Copy link
Member

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

@xk537
Copy link

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

@rmcantin Your solution worked for me 👍

@glyph
Copy link

glyph commented Aug 10, 2017

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

@Clara-YR
Copy link

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

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

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 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 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 commented Feb 3, 2019

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests