[baylisa] Reinstall python?

Roy S. Rapoport rsr at inorganic.org
Sat May 24 14:49:26 PDT 2003


I became a Python fanatic about a month or so ago (coming from Perl), so
I'm enthusiastic but clueless -- keep this in mind when you read my
response.

On Sat, May 24, 2003 at 10:10:16AM -0700, David Alban wrote:
>     File "/var/mailman/bin/mailmanctl", line 274, in check_privs
>       gid = grp.getgrnam(mm_cfg.MAILMAN_GROUP)[2]
>   KeyError: getgrnam(): name not found

That's actually not a Mailman/Python issue, but a Mailman configuration
issue.  It's not telling you that Python can't find the getgrnam
function, but rather that getgrnam is not able to find the group database entry for the entry that mm_cfg.MAILMAN_GROUP is pointing to.  In other words, the 
MAILMAN_GROUP variable in your mm_cfg.py or Defaults.py files has set does not
correspond to a UNIX group name on your system.

Can you verify whether this is, in fact, correct?

>     [EMAIL PROTECTED]:/mailman/run/bin> python
>     Python 2.2.2 (#3, Feb 11 2003, 16:57:53)
>     [GCC 2.95.3 20010315 (SuSE)] on linux2
>     Type "help", "copyright", "credits" or "license" for more
>     information.
>     >>> import paths
>     >>> from Mailman import mm_cfg
>     >>> from Mailman.mm_cfg import MAILMAN_USER, MAILMAN_GROUP
>     >>> print MAILMAN_USER, MAILMAN_GROUP
>     mailman mailman
>     >>> import grp
>     >>> MAILMAN_GID = grp.getgrnam(MAILMAN_GROUP)[2]
>     >>> print MAILMAN_GID
>     18
>     >>> import sys
>     >>> sys.exit()
>     [EMAIL PROTECTED]:/mailman/run/bin>
> 
> I try the above.  As soon as I type "import paths" and hit ENTER, I get:
> 
>   Traceback (most recent call last):
>     File "<stdin>", line 1, in ?
>   ImportError: No module named paths
> 
> Umm...  At this point I (who have no experience with python) am
> beginning to think there's something wrong with the python
> installation.  Or is this a case analogous to when perl's @INC array
> isn't set properly?

I'm not sure what the person who wrote the original stuff is trying to
do, but I note that 'paths' is not a standard Python module (see
http://www.python.org/doc/current/modindex.html).  os.path *is*.  On my
UNIX system with a perfectly (ha!) functioning Mailman install, I get
the same error you do -- no module named paths -- which makes perfect
sense.

For me, this code fragment works todo what they seem to want to do:
[first, cd to the directory containing mm_cfg.py, probably
PREFIX/Mailman]
---
23 nag /usr/local/mailman/Mailman # python
Python 2.2.2 (#2, Apr 10 2003, 15:36:19) 
[GCC 3.2.2] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> from mm_cfg import *
>>> print MAILMAN_USER, MAILMAN_GROUP
mailman mailman
>>> import grp
>>> print grp.getgrnam(MAILMAN_GROUP)[2]
105
>>> ^D
---

So I think you're probably not really SOL -- my guess is you just need
to tweak mm_cfg.py (or, technically, Defaults.py, though you should use
mm_cfg.py).

Two last notes, and this is where I veer away from factual information
and into editorializing:

A) Python is way cool, and I find that *ONCE I GOT USED TO IT*, its
error messages and stack traces became my favorite for an easy way to
figure out how something went wrong.  However, initially getting that
stack trace just scared me a little and made me go "Agh! What the hell
happened?"

B) Mailman is way cool, and I find that *ONCE I GOT IT WORKING*, it
worked like a beauty.  I find that, unfortunately, it doesn't
necessarily always fail gracefully and usefully -- in the above example,
for example, it was possible to write the code in a way that would trap
the error and report something useful ("Hi! Did you set your
MAILMAN_GROUP variable?"), but, well, they didn't. 

-roy




More information about the Baylisa mailing list