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
On notebook download, custom ContentsManager raises StaticFileHandler.initialize() exception #1313
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
The following work around seems the fix the immediate issue, however I am not sure of the implications of this. In your custom ContentsManager, add the following. class CustomContentsManager(ContentsManager): .... @default('files_handler_params') def _files_handler_params_default(self): return {'path': self.root_dir} Alternatively, add the following in your c.ContentsManager.file_handler_params = { 'path': '/valid/path' } What this does
|
I've faced the same error while using a hybridcontents content manager to allow both LargeFileManager and S3Contents in our jupyter hub deployment with helm. ## Contents of `jupyter_notebook_config.py` file
HOME_DIR = path.join("/home", environ["NB_USER"])
# Configure the variables for s3contents library for shared space
# Configure HybridContentsManager to use LargeFileManager for root dir and personal-space and S3ContentsManager for s3-shared-space
c.HybridContentsManager.manager_classes = {
# making the root dir read-only to contain guides and other read-only content
"": LargeFileManager,
# making the personal space read-write into an EBS volume
"personal-space": LargeFileManager,
# making the shared space read-write into an S3 bucket
"shared-space": S3ContentsManager,
}
c.HybridContentsManager.manager_kwargs = {
# using /tmp/read-only as the root dir, which is read-only, and contains guides that users would see when they open JupyterHub
"": {"root_dir": READ_ONLY_ROOT_DIR},
# using the user's home dir as the personal space, and is mounted to an EBS volume which is presisted across sessions
"personal-space": {"root_dir": HOME_DIR, "files_handler_params": {"path": HOME_DIR}},
# using the S3 bucket as the shared space, and is mounted to an S3 bucket which is presisted across sessions
"shared-space": {
"endpoint_url": S3_ENDPOINT_URL,
"bucket": S3_BUCKET_NAME,
"region_name": S3_REGION_NAME,
},
}
# To prevent `directory not found ""` error when opening JupyterLab
c.ServerApp.root_dir = HOME_DIR The above code is amended into Cheers |
@fakhavan I was able to resolve this by setting
|
Description
When implementing a custom ContentsManager, jupyter_server raises the following exception upon downloading files from Jupyter Lab, and the file will not be downloaded.
Reproduce
Implement a custom ContentsManager according to the guideline as documented here.
c.ServerApp.contents_manager_class=module.CustomContentsManager
File > Download
Expected behavior
The file is downloaded and no exception is raised.
Context
This used to work (i.e. did not raise an exception) in versions
jupyter_server<2
, however I did not investigate the exact version that changed the behavior.Troubleshoot Output
Command Line Output
Browser Output
The text was updated successfully, but these errors were encountered: