summaryrefslogtreecommitdiff
path: root/display
diff options
context:
space:
mode:
Diffstat (limited to 'display')
-rw-r--r--display/modes.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/display/modes.py b/display/modes.py
index 0ac680e..c43638d 100644
--- a/display/modes.py
+++ b/display/modes.py
@@ -1,4 +1,7 @@
import sys
+import importlib
+import traceback
+# import display.dpy_pygame
KeyPressed = 2
KeyReleased = 3
@@ -32,20 +35,27 @@ class Mode:
self.url = url
def getmodule(self):
- return __import__(self.prefix + self.name.lower(), globals(),
- locals(), ['available'])
+# import dpy_pygame
+ print( f"getmodule __import__ {self.prefix}{self.name.lower()}", file=sys.stderr )
+ return importlib.import_module( "display." + self.prefix + self.name.lower() )
+ #__import__(self.prefix + self.name.lower(), globals(),
+ # locals(), ['available'])
def imperror(self):
try:
return self.__imperror
except AttributeError:
try:
+ print( f"getmodule = {self}" )
module = self.getmodule()
- except ImportError:
+ except ImportError as e:
result = 'not installed'
+ print("== ImportError traceback:", file=sys.stderr )
+ traceback.print_exc(file=sys.stderr)
else:
result = hasattr(module, 'imperror') and module.imperror()
self.__imperror = result
+ print( f"imperror result={result}" )
return result
def unique_id(self):