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

ipython notebook --browser= switch does not work on windows #249

Closed
mikecroucher opened this issue Jul 31, 2015 · 7 comments
Closed

ipython notebook --browser= switch does not work on windows #249

mikecroucher opened this issue Jul 31, 2015 · 7 comments

Comments

@mikecroucher
Copy link

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.

@takluyver
Copy link
Member

What do you get from:

import webbrowser
webbrowser.get("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe")

@mikecroucher
Copy link
Author

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

@takluyver
Copy link
Member

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

@minrk
Copy link
Member

minrk commented Sep 11, 2015

@mikecroucher does it work if you do --browser='chrome'?

@Carreau
Copy link
Member

Carreau commented Sep 15, 2015

Closing for inactivity and issue in webbrowser module anyway.

@Carreau Carreau closed this as completed Sep 15, 2015
@wwwald
Copy link

wwwald commented Oct 9, 2015

For the sake of completeness: this can be made to work by registering Chrome in the webbrowser module first.
See this StackOverflow answer.

@minrk minrk added this to the no action milestone Dec 14, 2015
@Jonoda84
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 10, 2021
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

6 participants