data.py
changeset 1 2223ade4f259
child 2 e66102ab7048
equal deleted inserted replaced
0:257003279747 1:2223ade4f259
       
     1 """
       
     2     Functions to load data from various sources
       
     3 """
       
     4 
       
     5 import imp
       
     6 
       
     7 def load_py (path) :
       
     8     """
       
     9         Load a python file from the given filesystem path, returning the module itself
       
    10     """
       
    11 
       
    12     # XXX: what name to use?
       
    13     name = "hosts"
       
    14     
       
    15     # find the module
       
    16     file, pathname, info = imp.find_module(name, [path])
       
    17 
       
    18     # load it
       
    19     module = imp.load_module(name, file, pathname, info)
       
    20 
       
    21     # ok
       
    22     return module
       
    23