Importing email 0.96 problem

I've had some problems with getting 2.1a4 going on my Mandrake 8.1 installation and have gone back to a "clean" system.
The documented way to install email is: python setup.py install
This doesn't work for me as 2.1.1 is installed from an RPM and throws errors in relation to configure.
What seemed ok was to copy the email folder into the python2.1 site-packages folder. Running python interactively enables me to import email and check the version. I can also import email.Utils and others too.
I've created the site wide mailman list and also a test list from the command line. When I go to the /mailman/admin page I get a Bug error message
Traceback (most recent call last) File "/usr/local/mailman/scripts/driver", line 80 in run_main pkg = __import__('Mailman.Cgi', globals(), locals(), [scriptname]) File "../mailman/Cgi/admin.py", line 31, in ? from email.Utils import unquote, parseaddr ImportError: No module named Utils
Is there some othe part of python 2.1 that I need to hack?
Colin
-- Colin Mackinlay

"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 directory.
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?
-Barry

barry@zope.com (Barry A. Warsaw) writes:
Also, you may want to try upgrading to Python 2.1.2 to see if that fixes the problem.
Why not upgrade to Python 2.2 instead? Since 2.2 comes with the email module, he won't have to worry about installing it separately which seems to be the crux of his problem.
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.
I'm just curious, how much startup cost does this save? I hadn't thought of doing this before.
-- (TMDA (http://tmda.sourceforge.net/) (UCE intrusion prevention in Python)

barry@zope.com (Barry A. Warsaw) writes:
Also, you may want to try upgrading to Python 2.1.2 to see if that fixes the problem.
Why not upgrade to Python 2.2 instead? Since 2.2 comes with the email module, he won't have to worry about installing it separately which seems to be the crux of his problem. This is what I did originally, it makes a bit of a mess as 2.2 doesn't install by default into the same place that 2.1 lives (may be a Mandrake issue). Also what I go were a number of errors (from bsddb3 I think) which complained that programs were linked to differen versions of a
In <URL:news:local.mailman-d> on Mon 28 Jan, Jason R. Mastaler wrote: library file.
I went back to trying to hack 2.1.1 into using email as I was concerned that the libray errors were why my lit moderator pages wouldn't let me confirm new subscription requests.
-- Colin Mackinlay

"CM" == Colin Mackinlay <mailman-list@mackinlay.demon.co.uk> writes:
>> Why not upgrade to Python 2.2 instead? Since 2.2 comes with
>> the email module, he won't have to worry about installing it
>> separately which seems to be the crux of his problem.
CM> This is what I did originally, it makes a bit of a mess as 2.2
CM> doesn't install by default into the same place that 2.1 lives
CM> (may be a Mandrake issue).
I think so. From source, Python will install in /usr/local/bin by default, but Mandrake puts it in /usr/bin/python I believe. I've got MD8.1 on my laptop, and /usr/bin/python is 2.1.1.
Python install trick: if you want to have multiple version of Python live side-by-side in /usr/local, use "make install" for the one you want to be the default, and "make altinstall" for the others. Thus, you'll have /usr/local/bin/python and /usr/local/bin/pythonX.Y where X is the major rev and Y is the minor rev. You can't have micro (bug fix) releases live side-by-side AFAIK.
CM> Also what I go were a number of errors (from bsddb3 I think)
CM> which complained that programs were linked to differen
CM> versions of a library file.
Yeah, this is definitely a fragile bit of the configuration for Postfix integration. Probably too fragile for production. Sigh.
CM> I went back to trying to hack 2.1.1 into using email as I was
CM> concerned that the libray errors were why my lit moderator
CM> pages wouldn't let me confirm new subscription requests.
Hmm, Python 2.1.1 or 2.1.2 ought to work just fine, with the add-on email package of course.
-Barry

"JRM" == Jason R Mastaler <jason-list-mailman-developers@mastaler.com> writes:
>> Also, you may want to try upgrading to Python 2.1.2 to see if
>> that fixes the problem.
JRM> Why not upgrade to Python 2.2 instead? Since 2.2 comes with
JRM> the email module, he won't have to worry about installing it
JRM> separately which seems to be the crux of his problem.
That may not help, for a few reasons. First, there are some patches to the email package that got applied after 2.2 was released. For these, upgrading to Python 2.2.1 -- when it's ready -- would take care of the problem.
Second, Ben Gertzfield is working on some enhancements to the email package to better support Japanese (presumably, this extends to Korean, Chinese, etc.). Since those are new features, they won't make it into Python proper until 2.3, but I will add them to the email add-on package. So if you're probably best off still installing the add-on even in Python 2.2.
(Aside: I just realized that I'll have to change the order in which directories are added to sys.path in Defaults.py.in so that site-packages appears /before/ the default paths, otherwise you wouldn't get the add-on email package in Python 2.2. Hope that doesn't have any ugly consequences. :( We'll see...).
>> 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.
JRM> I'm just curious, how much startup cost does this save? I
JRM> hadn't thought of doing this before.
I don't remember the details, and they've likely changed since Python 2.0 when I made this change. If you want to get a feel for it, strace an interactive Python startup with and without -S. Enjoy the stat()'s :) IIRC they're significant, but with MM2.1's current architecture it will only hurt you during cgi startup, since the email side of things is done in a daemon now.
-Barry

In <URL:news:local.mailman-d> on Mon 28 Jan, Barry A. Warsaw wrote:
"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.
Traceback ..... File setup.py line 19 in ? . . . File "/usr/lib/python2.1/distutils/sysconfig.py" line 302, in _init_posix rais DistutilsPlatformError, my_msg
distutils.errors.DistutilsPlatformError invaid Python installation unable to open /usr/lib/python2.1/config/Makefile (no such file or directory)
Colin

"CM" == Colin Mackinlay <mailman-list@mackinlay.demon.co.uk> writes:
CM> Traceback .....
CM> File setup.py line 19 in ? . . . File
CM> "/usr/lib/python2.1/distutils/sysconfig.py" line 302, in
CM> _init_posix rais DistutilsPlatformError, my_msg
CM> distutils.errors.DistutilsPlatformError invaid Python
CM> installation unable to open /usr/lib/python2.1/config/Makefile
CM> (no such file or directory)
Possibly you need the python-devel rpms too? I think I hit a similar issue with StandaloneZODB, which I just released last Friday. Double check that and if that's not it, we can go from there.
-Barry

In <URL:news:local.mailman-d> on Mon 28 Jan, Barry A. Warsaw wrote:
[snip]
Possibly you need the python-devel rpms too? I think I hit a similar issue with StandaloneZODB, which I just released last Friday. Double check that and if that's not it, we can go from there.
[blushes]
email-0.96 straight in! Now that just leaves me withthe main problem I've been trying to fix - web based approval of list subscription. I asked this question originally on Mailman-Users before I realised Developers might be a more appropriate forum.
Of the four options available only one works properly! Defer: Fine because this is the default and nothing happens Approve: No message sent and not added to members list. DB is said to be updated but subscriber still appears in list of pending requests. Reject: Rejection message sent but subscriber remains in list of pending requests Discard: Subscriber remains in list of pending requests
There is no error reported and Ican't see anything in the logs to help track down the problem. Is there another level of logging I could turn on?
I received this reply from Jon Carnes on Mailman-Users:
From: Jon Carnes <jonc@haht.com> Subject: Re: [Mailman-Users] 2.1a4 Approving users not working To: mailman <mailman@mackinlay.demon.co.uk>, mailman-users@python.org
I believe that this is a browser specific problem. When I have seen this problem, it is always with IE 6.0 (or now that folks had to up-date, with 5.5 as well).
If that is the case, then add the site as "trusted" to your browser. After that, it will act properly.
BTW: I use Mandrake 8.1 and have to use Netscape for approvals, Konqueror has a problem in handling the page. Perhaps its the same problem that converting the site to "trusted" fixes for IE.
The problem manifests itself with IE6 and on RISCOS with Fresco and Oregano. I haven't tried netscape yet.
-- Colin Mackinlay

"CM" == Colin Mackinlay <mailman-list@mackinlay.demon.co.uk> writes:
CM> [blushes]
CM> email-0.96 straight in!
Yay!
CM> Now that just leaves me withthe main problem I've been trying
CM> to fix - web based approval of list subscription. I asked this
CM> question originally on Mailman-Users before I realised
CM> Developers might be a more appropriate forum.
For 2.1 issues, definitely.
CM> Of the four options available only one works properly! Defer:
CM> Fine because this is the default and nothing happens Approve:
CM> No message sent and not added to members list. DB is said to
CM> be updated but subscriber still appears in list of pending
CM> requests. Reject: Rejection message sent but subscriber
CM> remains in list of pending requests Discard: Subscriber
CM> remains in list of pending requests
CM> There is no error reported and Ican't see anything in the logs
CM> to help track down the problem. Is there another level of
CM> logging I could turn on?
I can't reproduce any of this using Mailman-cvs, on one of the latest post 0.9.6 Mozilla builds, Konquerer 2.2.1, NS 4.74, or IE 5.5 on W2K. All 4 subscription options seem to work just fine.
CM> The problem manifests itself with IE6 and on RISCOS with
CM> Fresco and Oregano. I haven't tried netscape yet.
I don't have IE6 so someone else is going to have to verify this.
If you're using 2.1a4, then please update to CVS, although I can't think of a change that might affect this.
-Barry
participants (3)
-
barry@zope.com
-
Colin Mackinlay
-
Jason R. Mastaler