]> git.llucax.com Git - software/pymin.git/blob - pymin/service/__init__.py
Move services outside the "static" pymin modules structure (refs #27).
[software/pymin.git] / pymin / service / __init__.py
1 # vim: set encoding=utf-8 et sw=4 sts=4 :
2
3 import imp
4
5 class LoadError(ImportError):
6     pass
7
8 def load_service(name, search_paths):
9     try:
10         (fp, path, desc) = imp.find_module(name, search_paths)
11     except ImportError:
12         raise LoadError('module "%s" not found' % name)
13
14     try:
15         return imp.load_module(name, fp, path, desc)
16     finally:
17         if fp:
18             fp.close()
19