mailer
mailer copied to clipboard
AttributeError: manager when testing example in docs
Hi, I'm using the example in the docs: from marrow.mailer import Mailer, Message
mailer = Mailer(dict(
transport = dict(
use = 'smtp',
host = 'localhost')))
mailer.start()
message = Message(author="[email protected]", to="[email protected]")
message.subject = "Testing Marrow Mailer"
message.plain = "This is a test."
mailer.send(message)
mailer.stop()
But getting the following traceback:
File "test_email.py", line 6, in <module>
host = 'localhost')))
File "/usr/lib/python2.6/site-packages/marrow/mailer/__init__.py", line 83, in __init__
raise LookupError("Unable to determine manager from specification: %r" % (config.manager, ))
File "/usr/lib/python2.6/site-packages/marrow/util/bunch.py", line 29, in __getattr__
raise AttributeError(name)
AttributeError: manager
Any thoughts? I'm running python 2.6 and marrow.mailer:
[user@domain scripts]$ pip freeze | grep marrow
marrow.mailer==4.0.1
marrow.util==1.2.3
Hi, I updated my script to match the one in the project examples:
import logging
from marrow.mailer import Message, Mailer
logging.basicConfig(level=logging.INFO)
mail = Mailer({
'manager.use': 'futures',
'transport.use': 'smtp',
'transport.host': 'localhost',
'transport.max_messages_per_connection': 5
})
mail.start()
message = Message([('Alice Bevan-McGregor', '[email protected]')],
[('Alice Two', '[email protected]')],
"This is a test message.",
plain="Testing!")
mail.send(message)
mail.stop()
But it still fails and throws:
Traceback (most recent call last):
File "test_email.py", line 9, in <module>
'transport.max_messages_per_connection': 5
File "/usr/lib/python2.6/site-packages/marrow/mailer/__init__.py", line 83, in __init__
raise LookupError("Unable to determine manager from specification: %r" % (config.manager, ))
LookupError: Unable to determine manager from specification: Bunch({'use': 'futures'})
Any thoughts?
Hello,
I came to the conclusion that Marrow Mailer doesn't work on Py2.6. Tested and working perfectly fine on Py2.7.
Thanks //M
Closing as ancient; futures-based managers require the backport of futures
to function prior to Python 3.
Python 2 is dead and unsupported.