Edward K. Ream wrote:
... BTW, the intention of the leo/extensions folder is that
Leo will use the PMW there if PMW is not installed on a system.
Apparently that didn't happen for you...


Well, some further testing has revealed that if Pmw cannot be loaded, Leo won't start -- so it was getting loaded eventually.

Turns out the import error was from the first time through the [None, 'extensions', 'external'] loop, but as it was showing up in the log window I thought Pmw wasn't being loaded at all.

I made a couple changes to my copy so such messages aren't displayed unless the module isn't ever loaded -- here's the patch if you would like to merge it in.

  def importModule (moduleName,pluginName=None,verbose=False):

+     g.es('loading %s' % moduleName, color='blue')
+     exceptions = []
      try:
          theFile = None
          import imp
.
.
.
                      if module: break
-             # except ImportError:
-                 # if trace: g.trace('not found',moduleName,findPath)
-             except Exception:
-                 g.es('Exception loading %s module' %
                                           (moduleName),color='blue')
+                 except Exception as e:
+                     if trace: g.trace(e.message,moduleName,findPath)
+                     if e.message not in exceptions:
+                          exceptions.append(e.message)
+             else:
+                 #unable to load module, display all exception messages
+                 for e in exceptions:
+                     g.es(e, color='blue')

diff -r 409a8fc2b4ca leo/core/leoGlobals.py
--- a/leo/core/leoGlobals.py    Wed Jan 12 14:54:30 2011 -0800
+++ b/leo/core/leoGlobals.py    Thu Jan 13 10:11:49 2011 -0800
@@ -4963,6 +4963,8 @@
     module = sys.modules.get(moduleName)
     if module:  return module
 
+    g.es('loading %s' % moduleName, color='blue')
+    exceptions = []
     try:
         theFile = None
         import imp
@@ -4981,10 +4983,14 @@
                     if trace: g.trace(theFile,moduleName,pathname)
                     module = 
imp.load_module(moduleName,theFile,pathname,description)
                     if module: break
-                # except ImportError:
-                    # if trace: g.trace('not found',moduleName,findPath)
-                except Exception:
-                    g.es('Exception loading %s module' % 
(moduleName),color='blue')
+                except Exception as e:
+                    if trace: g.trace(e.message,moduleName,findPath)
+                    if e.message not in exceptions:
+                        exceptions.append(e.message)
+            else: 
+                #unable to load module, display all exception messages
+                for e in exceptions:
+                    g.es(e, color='blue')
         except Exception: # Importing a module can throw exceptions other than 
ImportError.
             g.es_exception()
     finally:
-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to