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. IIRC, the subject header is actually optional. Maybe someone sent a message without a subject? Is msghdr["subject"] None? -- https://mail.python.org/mailman/listinfo/python-list