notebook: 404 error when starting notebook from a hidden folder

I’m getting a 404 error when I start a jupyter notebook and point it to a hidden folder.

Note: this is resolved, see update below

For me this was enough to recreate the problem:

mkdir test
mkdir .test

# works
jupyter notebook --notebook-dir=./test

# 404 error
jupyter notebook --notebook-dir=./.test

Update

This is not an error, but is expected behavior. Jupyter Notebooks don’t serve hidden folders for safety reasons. Newer versions of the notebook server make it possible to launch the server from a hidden folder. Try running:

pip install --upgrade jupyter

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 12
  • Comments: 37 (16 by maintainers)

Commits related to this issue

Most upvoted comments

🎉 🎉 🎉 🎉 woooo @takluyver 🎉 🎉 🎉 🎉

OK - so, I looked into this a little bit, and I don’t believe that it’s a bug, it’s intended behavior. See here:

https://github.com/jupyter/notebook/blob/master/notebook/tree/handlers.py#L44

So clearly notebook explicitly is not allowing hidden folders. I played around with getting this to work and it seems like it’d be non-trivial to add support for hidden folders (somebody correct me if I’m wrong). So, I think the real problem here is that the error messages you get when starting from hidden folders are not helpful. From the user’s perspective it feels like a bug and isn’t clarified as intended, which is why folks are getting frustrated here.

A few ideas that could help this:

  1. In the error message that is logged, rather than on top of saying “Refusing to serve hidden directory” I’d add “(hidden directories not yet supported)” or something along these lines.
  2. In the 404 page the notebook throws, what if we added some more useful information there, so instead of just
{% extends "error.html" %}
{% block error_detail %}
<p>You are requesting a page that does not exist!</p>
{% endblock %}

we added a short list of possible fixes below that are common to jupyter, so the page looks something like:


You are requesting a page that does not exist!

The following steps might help:

  1. Did you type in or click on a URL? Make sure there are no type-os and the path is correct.
  2. Are you attempting to access a hidden folder? Hidden folders are not supported with the Notebook UI.
  3. …anything else?

Thoughts? @takluyver and maybe @minrk has thoughts too? Let me know and then I will clarify this issue title/top-level comment (or I’ll open a PR and turn this issue into a feature request)

Are you guys EVER going to fix this shit?

I’m also seeing the same thing after updating a Windows install. But in my case the folder is not really hidden. I have a bunch of notebooks stored in my .ipython folder. When running

#404 error
cd c:\users\tj\.ipython
jupyter notebook

#works
cd c:\users\tj\.ipython\test
jupyter notebook

If you right-click properties on the .ipython folder it will look like the read-only box is checked. But this is true for all folders in windows and is misleading (it’s not really readonly). This can be verified using:

(C:\Anaconda3) C:\Users\tj>attrib .ipython
             C:\Users\tj\.ipython

Here’s a copy of the server error message:

(C:\Anaconda3) C:\Users\tj\.ipython>jupyter notebook
[I 05:54:30.053 NotebookApp] Serving notebooks from local directory: C:\Users\tj\.ipython
[I 05:54:30.054 NotebookApp] 0 active kernels
[I 05:54:30.054 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=91fd95901828a7e9dbfccc166eaa977bb508bf8813a2f064
[I 05:54:30.054 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 05:54:30.082 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=91fd95901828a7e9dbfccc166eaa977bb508bf8813a2f064
[I 05:54:30.565 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[I 05:54:30.567 NotebookApp] Refusing to serve hidden directory, via 404 Error
[W 05:54:30.658 NotebookApp] 404 GET /tree?token=bc1848cfa7a983646a888ae7ded3bfb6ec54cdc7ac9653f1 (::1) 94.25ms referer=None

@hichoe95 Thank you so much , I solved this proplem too …

maybe you should try 'pip3 install --upgrade jupyter ’

i solved it with this way

And please keep it civil even when responding to other people who may not have been completely civil themselves. Sweary comments make everyone angry and unproductive.

The comment I’m referring to has been deleted, but everyone who’s commented on this issue got it by email already. So I wanted to post this before anyone feels the need to make their own angry response. Take a deep breath and move on.

(I know this can be difficult - I bit back the urge to write something snarkier in my own response, and I could probably have bitten it further back than I did. Thanks @choldgraf for getting the discussion back on track after that.)

Point taken. Forgive the rant, I was frustrated. My apologies. Pretty much a newbie.

In the meantime I expect I’ll have to revert to 4.3 where I didn’t have the problem.

Seems to be the only way to get you people to respond to things. The has been a problem for some six months now, yet people - myself included - continue to have a problem with it.

People would be “civil” if you guys would actually address the issue, or at least provide a status update when people indicate they’re having problems. That’s civil. Silence is as bad as insult.

Please remain civil when asking people to fix bugs. Being rude about it does not make us eager to help you.