[Mailman-Developers] Importing email 0.96 problem

Barry A. Warsaw barry@zope.com
Mon, 28 Jan 2002 00:31:53 -0500

>>>>> "CM" == Colin Mackinlay <mailman-list@mackinlay.demon.co.uk> writes:

    CM> The documented way to install email is: python setup.py
    CM> install

    CM> This doesn't work for me as 2.1.1 is installed from an RPM and
    CM> throws errors in relation to configure.

I'd like to see the exact errors that occur.  This may indicate a bug
in Python's distutils system.  Or it could be that you need the devel
rpms for Python (although that would suck, since email is a pure
Python package -- i.e. no C extensions).  Also, you may want to try
upgrading to Python 2.1.2 to see if that fixes the problem.

In any case, I'd like to know more about this failure.

    CM> What seemed ok was to copy the email folder into the python2.1
    CM> site-packages folder. Running python interactively enables me
    CM> to import email and check the version. I can also import
    CM> email.Utils and others too.

By default, running "python" w/o the -S option executes site.py, which
adds to sys.path all the necessary directories to find site packages.
However, to decrease startup costs, all Mailman cgi and mail filter
programs effectively run with the -S option, which inhibits importing
site.py, and thus does not add any of the site-packages folders to
sys.path.  To make up for this, Defaults.py always adds

    sys.prefix + 'lib/python' + sys.version[:3] + 'site-packages'

to sys.path.  Make sure this is the path that contains the email

    CM> I've created the site wide mailman list and also a test list
    CM> from the command line. When I go to the /mailman/admin page I
    CM> get a Bug error message

    CM> Traceback (most recent call last)
    >> le "/usr/local/mailman/scripts/driver", line 80 in run_main pkg =
    >> __import__('Mailman.Cgi', globals(), locals(), [scriptname]) le
    >> "../mailman/Cgi/admin.py", line 31, in ?  from email.Utils import
    >> unquote, parseaddr
    CM> ImportError: No module named Utils

    CM> Is there some othe part of python 2.1 that I need to hack?

Shouldn't be, but you can try this:

In mm_cfg.py add the lines:

import sys
print >> sys.stderr, sys.path

Then run one of the command line scripts, e.g. bin/list_lists.  Do you
get the same error?  What does the output say?  Is the directory into
which you copied email's directory?