From: Mark Lawrence on
On 24/05/2010 14:59, dirknbr wrote:
> I have now easy_installled email and I still get errors.
I've done this as well, but don't see why I have to. Is this a
documentation bug, an installation bug or what?
>
> It doesn't error on 'import email' but does on call to MimeText.
>
> import email
> msg = MIMEText('test')
>
> NameError: name 'MIMEText' is not defined
>
> What should I do?
Give the fully qualified name i.e. email.mime.text.MIMEText.

Regards.

Mark Lawrence.

From: Jean-Michel Pichavant on
Dirk Nachbar wrote:
> Sorry guys, I had named my file email.py and hence the error.
>
>
>
> On 24 May 2010 15:22, Jean-Michel Pichavant <jeanmichel(a)sequans.com
> <mailto:jeanmichel(a)sequans.com>> wrote:
>
> dirknbr wrote:
>
> I have now easy_installled email and I still get errors.
>
>
> It doesn't error on 'import email' but does on call to MimeText.
>
> import email
> msg = MIMEText('test')
>
> NameError: name 'MIMEText' is not defined
>
> What should I do?
>
>
> Using easy_install will not prevent the standard lib to be
> shadowed by another (user) module.
>
> did you print email.__file__ to verify the path ?
> Can you show us the output ?
>
> To give you an example, on a lenny python 2.5 distrib, the
> MIMEText class is in
> /usr/lib/python2.5/email/mime/text.py
>
> JM
>
>
>
>
Classic error, you're not the first one, and my guess is that you won't
be the last.

JM