Skip to main content

module_dir

Find the name of the directory that contains a module, if possible.

Raise ValueError otherwise, e.g. for namespace packages that are split over several directories.

def module_dir(
module: module
) - > string

Find the name of the directory that contains a module, if possible. Raise ValueError otherwise, e.g. for namespace packages that are split over several directories.

Parameters

NameTypeDescription
modulemoduleThe Python module object whose filesystem location is being queried.

Returns

TypeDescription
stringThe absolute path to the directory containing the specified module's source files.