Issue: always open a html file when opening jupyter lab in wsl2

I have searched for few days but can’t find the solution to automatically close it.
Could someone help me to deal with the problem?
It is a little annoying…

Based on the title I would guess that you have no browser on the linux side of WSL so when jupyter attempts to open a browser the operating system opens the only other application that accepts HTML files and in this case it is a terminal editor.

I would try passing --no-browser option on the command line when launching JupyterLab.

3 Likes

Thanks a lot! It works!
By the way, could it be a default setting?

1 Like

Many users expect the browser to open when they launch jupyter lab from command line, and for majority it does open a useful (default) browser (rather than a file editor), so a change in the default behaviour may not go well with many users.

However, you can change the default for yourself by settings:

c.ServerApp.open_browser = False
c.LabApp.open_browser = False

in jupyter_server_config.py possibly only one of these is required). For location of the file see Config file and command line options — Jupyter Server documentation and jupyter --paths.

3 Likes

Thanks for your detailed introduction! Love you~