
On 05/07/2014 04:50 PM, Mark Sapiro wrote:
On the other hand, it is a bit of overkill to do these as withlist scripts because of the withlist setup and takedown. You could, e.g., do something like
#! /path/to/bin/python import sys import paths from Mailman import MailList from Mailman.Errors import MMUnknownListError, NotAMemberError try: mlist = MailList.MailList(sys.argv[1]) except MMUnknownListError: print 'No such list: %s' % sys.argv[1] sys.exit(1) try: print mlist.getMemberName(sys.argv[2]) except NotAMemberError: print 'No address matched: %s' % member
There are two errors in the above.
The 7th line should be
mlist = MailList.MailList(sys.argv[1], lock=False)
and the last line should be
print 'No address matched: %s' % sys.argv[2]
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan