[Mailman-Users] prune_arch

Mark Sapiro mark at msapiro.net
Tue Sep 25 23:07:19 CEST 2012


Con Wieland wrote:
>
>I just found this very useful looking script but am getting the following errors when I try running it.
>
>./prune_arch -l mgsa-l -d 1095 -n   
>Traceback (most recent call last):
>  File "./prune_arch", line 191, in ?
>    main()
>  File "./prune_arch", line 156, in main
>    mdate = mktime_tz(parsedate_tz(msg['date']))
>  File "/usr/local/mailman/pythonlib/email/_parseaddr.py", line 140, in mktime_tz
>    if data[9] is None:
>TypeError: unsubscriptable object
>
>Any help would be appreciated


The issue is the script didn't take into account messages in the
mailbox without Date: headers. The scripts at
<http://www.msapiro.net/scripts/prune_arch> and
<http://fog.ccsf.cc.ca.us/~msapiro/scripts/prune_arch> have been
updated.

The fix is to change line 156 from

                mdate = mktime_tz(parsedate_tz(msg['date']))

to

                mdate = msg['date'] and
mktime_tz(parsedate_tz(msg['date']))

(watch out for wrapping above)

-- 
Mark Sapiro <mark at msapiro.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