Reputation: 6986
I have been able to read emails, and I can see the attachments, but they don't come in as .csv data. I guess it is an 'EncodedPayload' type?
The following code:
for filename, content in attachments:
logging.info("filename: " + filename)
fileReader = csv.reader(content.split("\n"))
gave me this error:
'EncodedPayload' object has no attribute 'split'
How do I parse a csv file given an EncodedPayload ?
Upvotes: 0
Views: 540
Reputation: 14175
call decode()
on your content:
fileReader = csv.reader(content.decode())
Upvotes: 1