get_script_dir

glotaran.utils.io.get_script_dir(*, nesting: int = 0) Path[source]

Get the parent folder a script is executed in.

This is a helper function for cross compatibility with jupyter notebooks. In notebooks the global __file__ variable isn’t set, thus we need different means to get the folder a script is defined in, which doesn’t change with the current working director the python interpreter was called from. :param nesting: Number to go up in the call stack to get to the initially calling function.

This is only needed for library code and not for user code. , by default 0 (direct call)

Returns:

Path to the folder the script was resides in.

Return type:

Path