bzr: ERROR: 'module' object has no attribute '__path__'

Lalo Martins lalo at exoweb.net
Sun Aug 28 01:15:32 BST 2005


And so says Matthieu Moy on 28/08/05 06:24...
> Hi,
> 
> I get the following when running "bzr plugins":
> 
> bzr: ERROR: 'module' object has no attribute '__path__'

hmm.  Someone copy-pasted from plugin.py too fast :-)  modules don't
have __path__, only packages do.

This fixes it:
*** modified file 'bzrlib/commands.py'
--- bzrlib/commands.py
+++ bzrlib/commands.py
@@ -1669,7 +1669,15 @@
         from inspect import getdoc
         from pprint import pprint
         for plugin in bzrlib.plugin.all_plugins:
-            print plugin.__path__[0]
+            if hasattr(plugin, '__path__'):
+                # package
+                print plugin.__path__[0]
+            elif hasattr(plugin, '__file__'):
+                # normal module
+                print plugin.__file__
+            else:
+                # some kind of weirdness... not sure how it got here
+                print repr(plugin)
             d = getdoc(plugin)
             if d:
                 print '\t', d.split('\n')[0]


best,
                                               Lalo Martins
--
      So many of our dreams at first seem impossible,
       then they seem improbable, and then, when we
       summon the will, they soon become inevitable.
--
http://www.exoweb.net/                  mailto:lalo at exoweb.net
GNU: never give up freedom                 http://www.gnu.org/





More information about the bazaar mailing list