Return
A 3-tuple of
(file, pathname, description).
File
An opened file or None if the module is a package (directory);Pathname
The path to the file or directory.Description
A 3-tuple of
(suffix, mode, type):
- suffix is the file extension (e.g. .py)
- mode is one of r or rb (file was opened as readable text or binary)
- type is one of PY_SOURCE, PY_COMPILED, C_EXTENSION, or PKG_DIRECTORY
Subdirectories
The method doesn't accept dotted notation to indicate that the module is in a sub-package. Instead you have to find the package first then the module:
path = os.path.dirname(__file__)
f, p, d = find_module('directory', [path])
f_2, p_2, d_2 = find_module('module_name', [p]))