AttributeError: 'SMTPConnection' object has no attribute 'send_text_and_attachment_email'

Bug #983983 reported by Bob Tanner
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
bzr email commit hook
Fix Released
Critical
Bob Tanner

Bug Description

Was debugging my problem documented at https://bugs.launchpad.net/bzr/+bug/983612.

Switch from gpg to gpg2.

bzr-email now throws an exception:

  File "/Users/tanner/.bazaar/plugins/email/emailer.py", line 247, in _send_using_smtplib
    smtp.send_text_and_attachment_email(from_addr, to_addrs,
AttributeError: 'SMTPConnection' object has no attribute 'send_text_and_attachment_email'

email$ bzr info
Lightweight checkout (format: pack-0.92)
Location:
  light checkout root: .
   checkout of branch: http://bazaar.launchpad.net/~bzr/bzr-email/trunk/

$ bzr update
Tree is up to date at revision 57 of branch http://bazaar.launchpad.net/~bzr/bzr-email/trunk

email$ bzr --version
Bazaar (bzr) 2.6.0dev2
  from bzr checkout /Users/tanner/projects/bzr.dev
    revision: 6522
    revid: <email address hidden>
    branch nick: bzr.dev
  Python interpreter: /usr/bin/python 2.7.1
  Python standard library: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
  Platform: Darwin-11.3.0-x86_64-i386-64bit
  bzrlib: /Users/tanner/projects/bzr.dev/bzrlib
  Bazaar configuration: /Users/tanner/.bazaar
  Bazaar log file: /Users/tanner/.bzr.log

Tue 2012-04-17 08:29:04 -0500
0.053 bazaar version: 2.6.0dev2
0.053 bzr arguments: [u'commit']
0.056 looking for plugins in /Users/tanner/.bazaar/plugins
0.062 looking for plugins in /Users/tanner/projects/bzr.dev/bzrlib/plugins
0.068 looking for plugins in /Library/Python/2.7/site-packages/bzrlib/plugins
0.070 encoding stdout as sys.stdout encoding 'US-ASCII'
0.091 opening working tree '/Users/tanner/tmp/zzz'
0.159 preparing to commit
[ 2765] 2012-04-17 08:29:04.949 INFO: Committing to: /Users/tanner/tmp/zzz/
0.170 Selecting files for commit with filter None
[ 2765] 2012-04-17 08:29:04.950 INFO: added a
[ 2765] 2012-04-17 08:29:04.950 INFO: added ah
[ 2765] 2012-04-17 08:29:04.950 INFO: added d
[ 2765] 2012-04-17 08:29:04.950 INFO: added df
[ 2765] 2012-04-17 08:29:04.950 INFO: added e
[ 2765] 2012-04-17 08:29:04.950 INFO: added f
[ 2765] 2012-04-17 08:29:04.950 INFO: added s
[ 2765] 2012-04-17 08:29:04.950 INFO: added sas
0.181 check paths: None
4.002 ** Env var TTY empty, cannot set GPG_TTY. Is TTY exported?
[ 2765] 2012-04-17 08:29:09.088 INFO: Committed revision 1.
4.309 Committed revid <email address hidden> as revno 1.
4.329 Transferred: 0kB (0.0kB/s r:0kB w:0kB)
4.333 Traceback (most recent call last):
  File "/Users/tanner/projects/bzr.dev/bzrlib/commands.py", line 930, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/Users/tanner/projects/bzr.dev/bzrlib/commands.py", line 1141, in run_bzr
    ret = run(*run_argv)
  File "/Users/tanner/projects/bzr.dev/bzrlib/commands.py", line 673, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/Users/tanner/projects/bzr.dev/bzrlib/commands.py", line 697, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/Users/tanner/projects/bzr.dev/bzrlib/cleanup.py", line 136, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/Users/tanner/projects/bzr.dev/bzrlib/cleanup.py", line 166, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/Users/tanner/projects/bzr.dev/bzrlib/builtins.py", line 3689, in run
    lossy=lossy)
  File "/Users/tanner/projects/bzr.dev/bzrlib/decorators.py", line 218, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/Users/tanner/projects/bzr.dev/bzrlib/workingtree_4.py", line 218, in commit
    result = WorkingTree.commit(self, message, revprops, *args, **kwargs)
  File "/Users/tanner/projects/bzr.dev/bzrlib/decorators.py", line 218, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/Users/tanner/projects/bzr.dev/bzrlib/mutabletree.py", line 211, in commit
    *args, **kwargs)
  File "/Users/tanner/projects/bzr.dev/bzrlib/commit.py", line 290, in commit
    lossy=lossy)
  File "/Users/tanner/projects/bzr.dev/bzrlib/cleanup.py", line 132, in run
    self.cleanups, self.func, self, *args, **kwargs)
  File "/Users/tanner/projects/bzr.dev/bzrlib/cleanup.py", line 166, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/Users/tanner/projects/bzr.dev/bzrlib/commit.py", line 465, in _commit
    self._process_post_hooks(old_revno, new_revno)
  File "/Users/tanner/projects/bzr.dev/bzrlib/commit.py", line 619, in _process_post_hooks
    self._process_hooks("post_commit", old_revno, new_revno)
  File "/Users/tanner/projects/bzr.dev/bzrlib/commit.py", line 658, in _process_hooks
    self.rev_id)
  File "/Users/tanner/.bazaar/plugins/email/__init__.py", line 86, in branch_commit_hook
    local_branch=local).send_maybe()
  File "/Users/tanner/.bazaar/plugins/email/emailer.py", line 267, in send_maybe
    self.send()
  File "/Users/tanner/.bazaar/plugins/email/emailer.py", line 206, in send
    self._send_using_smtplib()
  File "/Users/tanner/.bazaar/plugins/email/emailer.py", line 247, in _send_using_smtplib
    smtp.send_text_and_attachment_email(from_addr, to_addrs,
AttributeError: 'SMTPConnection' object has no attribute 'send_text_and_attachment_email'

4.335 couldn't find apport bug-reporting library: No module named apport
4.344 return code 4

Revision history for this message
Bob Tanner (tanner) wrote :

If I'm reading the code right bzr-email uses bzrlib/smtp_connection.py

The relevant code snippets from bzr-email:

    _smtplib_implementation = SMTPConnection

        smtp = self._smtplib_implementation(self.config)
        if diff:
            smtp.send_text_and_attachment_email(from_addr, to_addrs,
                                                subject, body, diff,
                                                self.diff_filename(),
                                                self.extra_headers())

I do not see the send_text_and_attachment_email method in bzrlib/smtp_connection.py the only method I see about sending stuff is send_email(self, message):

Revision history for this message
Bob Tanner (tanner) wrote :

Put a fix up this issue at lp:~tanner/bzr-email/Bug983983

Testsuite runs clean.

$ ./bzr selftest -s bp.email
bzr selftest: /Users/tanner/projects/python-sandbox/bzr/bzr
   /Users/tanner/projects/python-sandbox/bzr/bzrlib
   bzr-2.6.0dev2 python-2.7.1 Darwin-11.3.0-x86_64-i386-64bit

----------------------------------------------------------------------
Ran 21 tests in 1.472s

OK

Thanks.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Thanks for the patch. Unfortunately the testsuite isn't much help here as it didn't reproduce this issue earlier either. :(

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Merged, thanks!

Changed in bzr-email:
status: New → Fix Committed
importance: Undecided → Critical
status: Fix Committed → Fix Released
assignee: nobody → Bob Tanner (tanner)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.