Loads a module and returns a specific object. module_name should 'module.file.object'. Returns object or raises EAException on error.
(module_name)
| 18 | |
| 19 | |
| 20 | def get_module(module_name): |
| 21 | """ Loads a module and returns a specific object. |
| 22 | module_name should 'module.file.object'. |
| 23 | Returns object or raises EAException on error. """ |
| 24 | sys.path.append(os.getcwd()) |
| 25 | try: |
| 26 | module_path, module_class = module_name.rsplit('.', 1) |
| 27 | base_module = __import__(module_path, globals(), locals(), [module_class]) |
| 28 | module = getattr(base_module, module_class) |
| 29 | except (ImportError, AttributeError, ValueError) as e: |
| 30 | raise EAException("Could not import module %s: %s" % (module_name, e)).with_traceback(sys.exc_info()[2]) |
| 31 | return module |
| 32 | |
| 33 | |
| 34 | def new_get_event_ts(ts_field): |
no test coverage detected