[Tutor] newbie: trouble importing email module
Jeff Shannon
jeff@ccvcorp.com
Thu Mar 13 13:11:01 2003
Craig Davey wrote:
> I'm very new to python, but I'm trying to create a simple cgi script
> that will send an email message. So I started out trying to construct
> a message using the email.Message module, unfortunately it seems like
> my isp is missing this module. Example:
>
> >>> import email
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> ImportError: No module named email
> >>>
>
> The version I am using is 2.1.2 on an OpenBSD system.
IIRC, the email module was added to the standard distribution starting
with Python 2.2 -- you're not doing anything wrong, it's just that
you're trying use a brand-new module and your ISP is using a slightly
dated version of Python. (At least they're not still using 1.5.2,
though!) You can try to encourage your ISP to upgrade to Python 2.2, or
if they're not interested, then I believe that this module was also made
available as a separate package for 2.1, you can try to track that down
(through the python.org website or through Google).
(Note that it *is* possible to send email messages without the email
module, it's just much more of a nuisance, especially if you're doing
anything like MIME or attachements. Failing both of the above options,
post here again and I'll share some of my old email code.)
Jeff Shannon
Technician/Programmer
Credit International