2qdxy4rzwzuui...@potatochowder.com wrote: > On 2021-02-17 at 15:40:27 +0000, > Chris Green <c...@isbd.net> wrote: > > > I'm running this using Python 3.7 on a Linux system. > > > > Most of the time (i.e. for a couple of days now) the program has been > > satifactorily delivering mail messages, hundreds of them. However one > > mail message has provoked the following error:- > > > > chris@cheddar$ tail mail.err > > Traceback (most recent call last): > > File "/home/chris/.mutt/bin/filter.py", line 95, in <module> > > if sbstrip in msghdr["subject"]: > > TypeError: argument of type 'Header' is not iterable > > > > > > But msghdr["subject"] is surely just a string isn't it? Why is it > > complaining about something of type 'Header'? > > Isn't it? ;-) > > First step: Print msghdr["subject"] and its type to know for sure. The > worst case is that you'll verify your assumption. > The documentation says "Headers are represented by customized subclasses of str", so it's a sub-class of str.
> IIRC, the subject header is actually optional. Maybe someone sent a > message without a subject? Is msghdr["subject"] None? If you look at the code (and the documentation) if there's no subject header I'll get the string "unknown", I've also tried sending myself an E-Mail with no header and not provoked the error. -- Chris Green ยท -- https://mail.python.org/mailman/listinfo/python-list