[Mailman-Users] Withlist Errors

Mark Sapiro msapiro at value.net
Thu Dec 15 02:24:35 CET 2005

Robert Haack wrote:

>I'm working on a procedure to change the number of recipients in lists. 
>Following a sample Mark Sapiro (Thank You Mark) I created the below
>procedure.  When I run it though I a bunch of errors.  Being that I know
>nothing about Python I was hoping that one of you might be able to point
>out what is wrong here.  If I need to post this to the python list
>instead just let me know.

The Python folks don't know about withlist or Mailman specific methods,
so this is the appropriate place.

>def cng_no_recipents(mlist):
>   mlist.Lock()
>   mlist.max_num_recipients = 100
>   mlist.Save()
>   mlist.Unlock()
>[root at nclack bin]# ./withlist -l -r cngnorecipe.cng_no_recipents test3
>Importing cngnorecipe...
>Running cngnorecipe.cng_no_recipents()...
>Loading list test3 (locked)
>Traceback (most recent call last):
>  File "./withlist", line 275, in ?
>    main()
>  File "./withlist", line 256, in main
>    r = do_list(listname, args, func)
>  File "./withlist", line 189, in do_list
>    return func(m, *args)
>  File "/var/mailman/bin/cngnorecipe.py", line 2, in cng_no_recipents
>    mlist.Lock()
>  File "/var/mailman/Mailman/MailList.py", line 159, in Lock
>    self.__lock.lock(timeout)
>  File "/var/mailman/Mailman/LockFile.py", line 291, in lock
>    raise AlreadyLockedError
>Unlocking (but not saving) list: test3

The problem is just what it says. The script is trying to lock the list
(mlist.Lock()), and the list is already locked (withlist -l option).
There are several ways around this, but the easiest is to just remove
-l from the withlist command.

Mark Sapiro <msapiro at value.net>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

More information about the Mailman-Users mailing list