diff options
Diffstat (limited to 'Tools/pynche')
-rw-r--r-- | Tools/pynche/PyncheWidget.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Tools/pynche/PyncheWidget.py b/Tools/pynche/PyncheWidget.py index d8ff8fa..4cddff1 100644 --- a/Tools/pynche/PyncheWidget.py +++ b/Tools/pynche/PyncheWidget.py @@ -294,7 +294,13 @@ def make_view_popups(switchboard, root, extrapath): for file in os.listdir(dir): if file[-9:] == 'Viewer.py': name = file[:-3] - module = __import__(name) + try: + module = __import__(name) + except ImportError: + # Pynche is running from inside a package, so get the + # module using the explicit path. + pkg = __import__('pynche.'+name) + module = getattr(pkg, name) if hasattr(module, 'ADDTOVIEW') and module.ADDTOVIEW: # this is an external viewer v = PopupViewer(module, name, switchboard, root) |