import_module
import_module(name)
Return the module identified by the given name.
import_module makes some attempts to prevent the imported
module from modifying sys and __builtins__ . In
the future, more sandboxing might be added (e.g., using the
rexec module).
-
- Parameters:
name -
The name of the module to import. name can either be a
module name (such as os.path ); a filename (such as
epytext.py or multiarray.so ); or a directory name
(such as site-packages/distutils ).
(type=string )
- Returns:
-
The module with the given name.
(type=module )
- Raises:
ImportError -
If there was any problem importing the given object. In particular, an
ImportError is raised if the given file does not exist; if the
given file name does not name a valid module; or if importing the module
causes an exception to be raised.
|