Django imports #407

Open
hectord opened this Issue Dec 4, 2013 · 0 comments

Comments

Projects
None yet
1 participant
@hectord
Contributor

hectord commented Dec 4, 2013

When I execute lettuce, I get the following exception:

Traceback (most recent call last):
File "/usr/local/bin/lettuce", line 9, in <module>
    load_entry_point('lettuce==0.2.19', 'console_scripts', 'lettuce')()
File "/usr/local/lib/python2.7/dist-packages/setuptools-1.1.5-py2.7.egg/pkg_resources.py", line 357, in load_entry_point
     return get_distribution(dist).load_entry_point(group, name)
File "/usr/local/lib/python2.7/dist-packages/setuptools-1.1.5-py2.7.egg/pkg_resources.py", line 2394, in load_entry_point
     return ep.load()
File "/usr/local/lib/python2.7/dist-packages/setuptools-1.1.5-py2.7.egg/pkg_resources.py", line 2108, in load
      entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/local/lib/python2.7/dist-packages/lettuce/__init__.py", line 44, in <module>
     from lettuce.plugins import (
File "/usr/local/lib/python2.7/dist-packages/lettuce/plugins/smtp_mail_queue.py", line 9, in <module>
     from django.core.mail import EmailMessage, EmailMultiAlternatives
ImportError: No module named django.core.mail

Everything works if I install Django.

I think we should import EmailMessage and EmailMultiAlternatives only in "_convert_to_django_msg".

I'll send a patch later.

hectord pushed a commit to hectord/lettuce that referenced this issue Dec 4, 2013

Siméon Blanc
Import django modules only if they are used.
This commit solves the issue #407.

davidsulc added a commit to davidsulc/lettuce that referenced this issue Jan 6, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment