User directories

Contents

User directories#

The h5rdmtoolbox uses a couple of local directories to store temporary files or manage cache files.

import h5rdmtoolbox as h5tbx
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 1
----> 1 import h5rdmtoolbox as h5tbx

File ~/checkouts/readthedocs.org/user_builds/h5rdmtoolbox/checkouts/v1.7.0/h5rdmtoolbox/__init__.py:129
    125     with File(src) as h5:
    126         return h5.dumps()
--> 129 from h5rdmtoolbox.wrapper.ld.hdf.file import get_ld as hdf_get_ld
    130 from h5rdmtoolbox.wrapper.ld.user.file import get_ld as user_get_ld
    133 def get_ld(
    134         hdf_filename: Union[str, pathlib.Path],
    135         structural: bool = True,
    136         semantic: bool = True,
    137         blank_node_iri_base: Optional[str] = None,
    138         **kwargs) -> rdflib.Graph:

File ~/checkouts/readthedocs.org/user_builds/h5rdmtoolbox/checkouts/v1.7.0/h5rdmtoolbox/wrapper/ld/__init__.py:1
----> 1 import ssnolib.ssno.standard_name
      2 from ontolutils.namespacelib import M4I
      3 from ontolutils.namespacelib import SCHEMA

ModuleNotFoundError: No module named 'ssnolib'

The UserDir variable manages the paths. The __repr__ indicates the different paths:

h5tbx.UserDir
DirManger(root, tmp, convention, layouts, repository, standard_name_tables, cache)

Examples#

Temporary files, e.g. created when empty h5tbx.File objects are created, will be put here:

h5tbx.UserDir['tmp']
WindowsPath('C:/Users/Matthias/AppData/Local/h5rdmtoolbox/h5rdmtoolbox/tmp/tmp_0')

Let’s check it:

with h5tbx.File() as h5:
    filename = h5.hdf_filename
filename
WindowsPath('C:/Users/Matthias/AppData/Local/h5rdmtoolbox/h5rdmtoolbox/tmp/tmp_0/tmp2.hdf')

Tokens for repositories, e.g. Zenodo, should be put here:

h5tbx.UserDir['repository']
WindowsPath('C:/Users/Matthias/AppData/Local/h5rdmtoolbox/h5rdmtoolbox/repository')