TNO Intern

Commit c11cf333 authored by Arjo Segers's avatar Arjo Segers
Browse files

Upgraded to importlib.

parent 20fb77d1
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -83,9 +83,7 @@ def ImportClass(moduleclass):
    import os
    import sys
    import time
    import imp

    # import importlib
    import importlib

    # check ..
    if "." not in moduleclass:
@@ -104,11 +102,7 @@ def ImportClass(moduleclass):

    # import this module with the specified class:
    try:
        # ~ this sometimes fails if module file was just copied to a newly created directory ...
        # mod = __import__( modulename, fromlist=[classname] )
        # ~ this seems to work for the moment ...
        fp, pathname, description = imp.find_module(modulename, sys.path)
        mod = imp.load_module(modulename, fp, pathname, description)
        mod = importlib.import_module( modulename )
    except ImportError:
        logging.error('Could not import module "%s" ...' % (modulename))
        logging.error("Search path:")