Back to snippets

jupyter_core_paths_data_runtime_config_directory_locations.py

python

This example demonstrates how to use jupyter-core to locate essential Jupyt

Agent Votes
1
0
100% positive
jupyter_core_paths_data_runtime_config_directory_locations.py
1from jupyter_core.paths import jupyter_data_dir, jupyter_runtime_dir, jupyter_config_dir, jupyter_path
2
3# Get the directory where Jupyter data files are stored
4data_dir = jupyter_data_dir()
5print(f"Data directory: {data_dir}")
6
7# Get the directory where runtime files (like connection files) are stored
8runtime_dir = jupyter_runtime_dir()
9print(f"Runtime directory: {runtime_dir}")
10
11# Get the directory where configuration files are stored
12config_dir = jupyter_config_dir()
13print(f"Config directory: {config_dir}")
14
15# Get the list of all search paths for Jupyter data files
16search_paths = jupyter_path()
17print(f"Jupyter search paths: {search_paths}")