-
Notifications
You must be signed in to change notification settings - Fork 313
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
System default browser not used, because serverapp started as "opening a local html file" #1488
Comments
See jupyter/notebook#4304 for the longstanding report for this, and various things folks have tried, and workarounds you can use. I think if This seems like we should report a bug to the standard library if there isn't one already, because |
Opened upstream issue: python/cpython#128540 I think we can work around this if we register our own default browser lookup, but I'm not sure how easy that is going to be. Linux actually seems to be the hardest, since the most standard mechanism I can think of is already used there ( What do you get from |
But it doesn't use the default web browser for .html files: it uses whatever the default application for .html is (so default browser in this case is irrelevant) |
Hm, I thought the And the result of |
xdg correctly loads firefox, and the "name" it reports is not a command:
The webbrowser module reports xdg-open as the default:
|
I think this is a bug in webbrowser's handling of I'm not sure what the right xdg invocation is to say "open this url with this specific application" |
Could even be a bug in
where, in my reading, the final bit says a
|
I guess you're meant to use this desktop entry, but that doesn't seem possible in a linux-flavour independent way: https://wiki.archlinux.org/title/Desktop_entries |
On my system you could do |
I've been reading into this a bit today, and there doesn't seem to be anything approaching consensus on locating and invoking applications, even on what works and what doesn't. For example, the limitation about gtk-launch search path doesn't even necessarily seem true, because I just did a fresh install of ubuntu 24.04 and gtk-launch $(xdg-settings get default-web-browser) file://$PWD/file.html and it launches firefox.desktop, which resides in /var/lib/snapd/desktop/applications/. It also works for .desktop files in ~/.local/share/applications. So
|
Description
On a fresh install of Fedora 41 (gnome 47) I suddenly found that the
jupyter notebook
command opened chrome, not my system default of firefox. This was really confusing as I couldn't see any configuration files, environment variables or anything else telling it to do this, andwebbrowser.open('https://google.com')
would load firefox as expected.Reproduce
Fresh install of recent linux, including multiple browsers.
Change default browser
After a lot of searching, I discovered it was because the default browser used by
webbrowser
isxdg-open
, which will use the system default browser forhttp://...
, but the default application for the.html
extension for local filesfile://...
.And because jupyter was starting as
file:///home/michael/.local/share/jupyter/runtime/jpserver-10052-open.html
this was treated as a local "opening a html file" action...
This gets worse, because if you do web development you might want the local "opening a html file" to be opening it in a text editor...
Expected behavior
Expecting notebook to "open a page in the default browser".
Instead it "perfoms the default action for opening a local html file"
Obvious solution would be to use
webbrowser.open('http://localhost:8888/tree?...
instead of getting there via a local file?
Context
Operating System and version: Fedora 41
Browser and version: Firefox and chrome
Jupyter Server version: 2.14.2
The text was updated successfully, but these errors were encountered: