Built-in Module imp

imp This module provides an interface to the mechanisms used to implement the import statement. It defines the following constants and functions:
\begin{funcdesc}{get_magic}{}
Return the magic string value used to recognize byte-compiled code
files (\lq\lq \code{.pyc} files'').
\end{funcdesc}

\begin{funcdesc}{get_suffixes}{}
Return a list of triples, each describing a par...
...}, defined
below. (System-dependent values may also be returned.)
\end{funcdesc}

\begin{funcdesc}{find_module}{name\, \optional{path}}
Try to find the module \va...
...eturned by \code{get_suffixes} describing the kind of file found.
\end{funcdesc}

\begin{funcdesc}{init_builtin}{name}
Initialize the built-in module called \var{...
...is no
built-in module called \var{name}, \code{None} is returned.
\end{funcdesc}

\begin{funcdesc}{init_frozen}{name}
Initialize the frozen module called \var{nam...
...Python's \code{freeze} utility.
See \code{Tools/freeze} for now.)
\end{funcdesc}

\begin{funcdesc}{is_builtin}{name}
Return \code{1} if there is a built-in module...
...Return \code{0} if there is no built-in module
called \var{name}.
\end{funcdesc}

\begin{funcdesc}{is_frozen}{name}
Return \code{1} if there is a frozen module (s...
..._frozen})
called \var{name}, \code{0} if there is no such module.
\end{funcdesc}

\begin{funcdesc}{load_compiled}{name\, pathname\, \optional{file}}
Load and init...
...be a real file object, not a
user-defined class emulating a file.
\end{funcdesc}

\begin{funcdesc}{load_dynamic}{name\, pathname\, \optional{file}}
Load and initi...
...ries is highly system dependent, and not all systems
support it.)
\end{funcdesc}

\begin{funcdesc}{load_source}{name\, pathname\, \optional{file}}
Load and initia...
...exists,
it will be used instead of parsing the given source file.
\end{funcdesc}

\begin{funcdesc}{new_module}{name}
Return a new empty module object called \var{name}. This object is
{\em not} inserted in \code{sys.modules}.
\end{funcdesc}
The following constants with integer values, defined in the module, are used to indicate the search result of imp.find_module.
\begin{datadesc}{SEARCH_ERROR}
The module was not found.
\end{datadesc}

\begin{datadesc}{PY_SOURCE}
The module was found as a source file.
\end{datadesc}

\begin{datadesc}{PY_COMPILED}
The module was found as a compiled code object file.
\end{datadesc}

\begin{datadesc}{C_EXTENSION}
The module was found as dynamically loadable shared library.
\end{datadesc}


Subsections