def load_plugin_from_file(self, filename):
        (path, name) = os.path.split(filename)
        (name, ext) = os.path.splitext(name)

        # insert the paths defined in the be_dirs into our path-variable
        for path in self.be_dirs:
            sys.path.insert(0, path)

        # look in the current search path for the given module_name
        try:
            (file_n, filename, data) = imp.find_module(name, [path])
            # load the module from file
            loaded_mod = imp.load_module(name, file_n, filename, data)
            log.info("loaded_mod: " + str(loaded_mod))

            # make sure the expected class is found in the loaded file. this
            # means the name of the file we are importing must match the class-
            # name in the file that is being imported (without .py). otherwise
            # we would not know which class to import from the file. it may
            # also contain various other classes we dont need to know about
            if hasattr(loaded_mod, name):
                plugin_class = getattr(loaded_mod, name)()
                log.info(plugin_class)
                self.backends[name] = plugin_class
            else:
                log.error("'{0}' found but class '{1}' not found in" + \
                          "file.".format(filename, name))

        except ImportError, i:
            log.exception(i)
            log.info("ERR1: file found but not loaded {0}".format(filename))
Returns the number of elements in the data series.
dataset/ETHPy150Open felskrone/salt-eventsd/salteventsd/backends.py/BackendMngr.load_plugin_from_file--crossover with--dataset/ETHPy150Open gbeced/pyalgotrade/pyalgotrade/dataseries/__init__.py/DataSeries.__len__