Using the `email' module in a bazaar plugin

Julian Smith jules at
Wed Dec 10 12:58:25 CET 2008

I don't seem to be able to use the `email' module from within a bazaar
plugin. Other modules work ok, e.g. nntplib.

Here's my plugin, cut-down to show just the email problem:

  import sys
  print 'sys.version', sys.version

  import nntplib
  n = nntplib.NNTP( 'jsmith-ubuntu2' )
  print n

  import email
  m=email.MIMEText.MIMEText('text of email')

- and here's the output when i run any bazaar command:

  > bzr status
  sys.version 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) 
  [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)]
  <nntplib.NNTP instance at 0xb7b1082c>
  'module' object has no attribute 'MIMEText'
  Unable to load plugin 'js_notify' from '/home/jsmith/.bazaar/plugins'

The plugin runs fine on its own, it's only when loaded into Bazaar that things
go wrong.

I thought perhaps this could be caused by the `email' module's use of
LazyImporter. I've tried various things such as `from email.mime.text import
MIMEText', and they fail in similar ways.

I'm using bzr-1.9, python 2.5.2, on Ubuntu-8.xx.

Does anyone have any ideas ?


- Julian


More information about the Python-list mailing list