I have Google Chrome installed on 64bit Windows 7. It is not the default browser. I do
ipython notebook --browser="C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
which gives
[W 09:57:48.953 NotebookApp] No web browser found: could not locate runnable browser.
[I 09:57:53.960 NotebookApp] Interrupted...
[I 09:57:53.960 NotebookApp] Shutting down kernels
Same result if I do
ipython notebook --browser="C:\Program Files (x86)\Google/Chrome\Application\chrome.exe"
I've tried all sorts of ways of specifying the path to the browser but none of them work. I am aware of other methods to select the browser used but feel that this method should work too.
What do you get from:
import webbrowser
webbrowser.get("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe")
In An IPython session
In [3]: import webbrowser
In [4]: webbrowser.get("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")
---------------------------------------------------------------------------
Error Traceback (most recent call last)
<ipython-input-4-37fdc3f3c27d> in <module>()
----> 1 webbrowser.get("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")
C:\Anaconda\lib\webbrowser.pyc in get(using)
50 elif command[0] is not None:
51 return command[0]()
---> 52 raise Error("could not locate runnable browser")
53
54 # Please note: the following definition hides a builtin function.
Error: could not locate runnable browser
The file IS there, however:
In [5]: ls "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
Volume in drive C has no label.
Volume Serial Number is 1A8B-DF1C
Directory of C:\Program Files (x86)\Google\Chrome\Application
07/25/2015 09:46 AM 813,896 chrome.exe
1 File(s) 813,896 bytes
0 Dir(s) 42,196,086,784 bytes free
I realised that in my original report, I had mixed back and forward slashes in the second command so in cmd.exe I did
ipython notebook --browser="C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
Doesn't work. Same error as reported originially.
Back to IPython, changing the direction of slashes around gives the same error but this time, file not found when doing an ls
In [6]: ls "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
Volume in drive C has no label.
Volume Serial Number is 1A8B-DF1C
Directory of C:\Program Files (x86)\Google\Chrome\Application
File Not Found
Looking at the docs for the webbrowser module, it looks like you're supposed to pass a name like 'chrome' instead of a path: https://docs.python.org/3/library/webbrowser.html
@mikecroucher does it work if you do --browser='chrome'?
Closing for inactivity and issue in webbrowser module anyway.
For the sake of completeness: this can be made to work by registering Chrome in the webbrowser module first.
See this StackOverflow answer.
Just add ''%s" or "%s --new-window" after the path, like:
c.NotebookApp.browser = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s"
c.NotebookApp.browser = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s --new-window"
The latter one will just make new window. It should work.
Most helpful comment
Just add ''%s" or "%s --new-window" after the path, like:
c.NotebookApp.browser = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s"
c.NotebookApp.browser = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s --new-window"
The latter one will just make new window. It should work.