FAQ
Hello,

I'm following up my own message because we seem to have resolved our
issue with MM2.1.2 shunting messages with a "TypeError: iterable
argument required" traceback.

We re-created our list and got email flowing again which was our main
concern. Andrew Dalke then had the time to check out the traceback
errors and the messages that remaind in the shunt/ directory.

He is suggesting a patch or a possible fix so I'm enclosing his entire
message here:

Our server is an ancient Alpha box running RedHat Linux 6.2 with a clean
build of python 2.3.

Mailman is 2.1.2 but since we've been using MM for years and
upgrade-installing into the same directory I can't promise that our
problems were not caused entirely by old cruft laying around....


-Chris

Here are the notes from Andrew:
Actually, I didn't get your email about the shunt problem, I got it
about the archive problem. So I'm sending this to you to let
you forward to mailman developers in the proper context

Here's the traceback

Traceback (most recent call last):
File "/home/mailman/Mailman/Queue/Runner.py", line 105, in _oneloop
self._onefile(msg, msgdata)
File "/home/mailman/Mailman/Queue/Runner.py", line 155, in _onefile
keepqueued = self._dispose(mlist, msg, msgdata)
File "/home/mailman/Mailman/Queue/IncomingRunner.py", line 130, in _dispose
more = self._dopipeline(mlist, msg, msgdata, pipeline)
File "/home/mailman/Mailman/Queue/IncomingRunner.py", line 153, in _dopipeline
sys.modules[modname].process(mlist, msg, msgdata)
File "/home/mailman/Mailman/Handlers/ToDigest.py", line 89, in process
send_digests(mlist, mboxfp)
File "/home/mailman/Mailman/Handlers/ToDigest.py", line 130, in send_digests
send_i18n_digests(mlist, mboxfp)
File "/home/mailman/Mailman/Handlers/ToDigest.py", line 303, in send_i18n_digests
msg = scrubber(mlist, msg)
File "/home/mailman/Mailman/Handlers/Scrubber.py", line 257, in process
url = save_attachment(mlist, part, dir)
File "/home/mailman/Mailman/Handlers/Scrubber.py", line 349, in save_attachment
ext = guess_extension(ctype, fnext)
File "/home/mailman/Mailman/Handlers/Scrubber.py", line 80, in guess_extension
if ext in all:
TypeError: iterable argument required

It occurs when Scrubber.guess_extension . The code does

all = guess_all_extensions(ctype, strict=0)
if ext in all:
return ext
return all and all[0]

The function 'guess_all_extensions' comes from the top of the
files from the section

try:
from mimetypes import guess_all_extensions
except ImportError:
import mimetypes
def guess_all_extensions(ctype, strict=1):
# BAW: sigh, guess_all_extensions() is new in Python 2.3

We're running Python 2.3, which means we're using the
one from mimetypes. That function's docstring says

guess_type(). If no extension can be guessed for `type', None
is returned.

So if no extension can be guessed, then Scrubber.guess_extension
try to iterate over None, which fails

Our fix to get things working again is

all = guess_all_extensions(ctype, strict=0)
if all is None: all = []
if ext in all:
return ext
return all and all[0]

However, another possibility is that the guess_all_extensions
in Python 2.3's mimetypes should return [] when it cannot
guess, rather than a None. I would be happier with that
solution than this patch, but will leave it up to the Mailman
and Python people to decide on the appropriate solution.

Andrew Dalke
dalke at dalkescientific.com

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
groupmailman-users @
categoriespython
postedMay 6, '03 at 8:38p
activeMay 7, '03 at 7:02p
posts2
users1
websitelist.org

1 user in discussion

Chris Dagdigian: 2 posts

People

Translate

site design / logo © 2022 Grokbase