Fix some harmless import errors that were exposed by last commit
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index fa2c488..0925edd 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -146,6 +146,7 @@
'''
This method will initialize specified component
'''
+ import importlib
global driver_options
self.log.info("Creating component Handle: "+component)
driver_options = {}
@@ -157,7 +158,7 @@
driver_options ['type'] = driverName
classPath = self.getDriverPath(driverName.lower())
- driverModule = __import__(classPath, globals(), locals(), [driverName.lower()], -1)
+ driverModule = importlib.import_module(classPath)
driverClass = getattr(driverModule, driverName)
driverObject = driverClass()
diff --git a/TestON/drivers/component.py b/TestON/drivers/component.py
index 503acbe..f05be55 100644
--- a/TestON/drivers/component.py
+++ b/TestON/drivers/component.py
@@ -32,6 +32,7 @@
def __init__( self ):
self.default = ''
self.wrapped = sys.modules[ __name__ ]
+ self.count = 0
def __getattr__( self, name ):
"""
@@ -43,7 +44,12 @@
try:
return getattr( self.wrapped, name )
except AttributeError as error:
- main.log.error( str(error.__class__) + " " + str(error) )
+ # NOTE: The first time we load a driver module we get this error
+ if "'module' object has no attribute '__path__'" in error\
+ and self.count == 0:
+ self.count += 1
+ else:
+ main.log.error( str(error.__class__) + " " + str(error) )
try:
def experimentHandling( *args, **kwargs ):
if main.EXPERIMENTAL_MODE == main.TRUE: