Skip to main content

get_root_path

Find the root path of a package, or the path that contains a module. If it cannot be found, returns the current working directory.

def get_root_path(
import_name: str
) - > str

Find the root path of a package, or the path that contains a module. If it cannot be found, returns the current working directory.

Parameters​

NameTypeDescription
import_namestrThe full dotted name of the module or package to locate on the filesystem

Returns​

TypeDescription
strThe absolute path to the directory containing the module or package, or the current working directory as a fallback