Package gmisclib :: Module load_mod
[frames] | no frames]

Module load_mod

source code

This module has functions that help you dynamically import modules.

Functions
 
split_name(name)
Split a name in the form a/b.c into a, b, c, where a is a search path, b is a module (package) name, and c is a name in the module.
source code
 
load(name, path)
Load a module from the specified list of paths.
source code
 
load_mod(name, path)
Load a module from the specified list of paths.
source code
 
load_inc_path(name, path)
Load a module from the specified list of paths.
source code
 
load_mod_inc_path(name, path)
Load a module from the specified list of paths.
source code
 
load_named(name, use_sys_path=True)
Load a module.
source code
 
load_named_module(name, use_sys_path=True)
Load a module.
source code
 
load_named_fcn(name, use_sys_path=True)
Load a module.
source code
 
load_fcn(name, use_sys_path=True)
Load a module.
source code
Variables
  __package__ = 'gmisclib'

Imports: sys, imp, os, die


Function Details

load(name, path)

source code 

Load a module from the specified list of paths. It returns the module, but does not import it. If path is None, only look in sys.path and builtins. If path is an array containing None, replace the None with sys.path.

load_mod(name, path)

source code 

Load a module from the specified list of paths. It returns the module, but does not import it. If path is None, only look in sys.path and builtins. If path is an array containing None, replace the None with sys.path.

load_inc_path(name, path)

source code 

Load a module from the specified list of paths. It returns the module, but does not import it. If path is None, only look in sys.path and builtins. If path is an array containing None, replace the None with sys.path.

load_mod_inc_path(name, path)

source code 

Load a module from the specified list of paths. It returns the module, but does not import it. If path is None, only look in sys.path and builtins. If path is an array containing None, replace the None with sys.path.

load_named(name, use_sys_path=True)

source code 

Load a module. If the module name is in the form a/b, it looks in directory "a" first. If use_sys_path is true, it searches the entire Python path

It returns the module, but does not import it. This version handles importing packages and functions nicely, but with less control over the search path.

Usage:

  • load_named_module('/dir/my_module'), or
  • load_named_module('foo/my_module'), or
  • load_named_module('foo/my_module.submodule.function'), or
  • various combinations.

load_named_module(name, use_sys_path=True)

source code 

Load a module. If the module name is in the form a/b, it looks in directory "a" first. If use_sys_path is true, it searches the entire Python path

It returns the module, but does not import it. This version handles importing packages and functions nicely, but with less control over the search path.

Usage:

  • load_named_module('/dir/my_module'), or
  • load_named_module('foo/my_module'), or
  • load_named_module('foo/my_module.submodule.function'), or
  • various combinations.

load_named_fcn(name, use_sys_path=True)

source code 

Load a module. If the module name is in the form a/b, it looks in directory "a" first. If use_sys_path is true, it searches the entire Python path

It returns the module, but does not import it. This version handles importing packages and functions nicely, but with less control over the search path.

Usage:

  • load_named_module('/dir/my_module'), or
  • load_named_module('foo/my_module'), or
  • load_named_module('foo/my_module.submodule.function'), or
  • various combinations.

load_fcn(name, use_sys_path=True)

source code 

Load a module. If the module name is in the form a/b, it looks in directory "a" first. If use_sys_path is true, it searches the entire Python path

It returns the module, but does not import it. This version handles importing packages and functions nicely, but with less control over the search path.

Usage:

  • load_named_module('/dir/my_module'), or
  • load_named_module('foo/my_module'), or
  • load_named_module('foo/my_module.submodule.function'), or
  • various combinations.