Can do as i have showed you,but you pass out
Or you can look at
PEP-8
TypeError
.Or you can look at
email_message.get('Subject')
and try to clean it up before doing messageSubject + '.txt'
.PEP-8