Closed johnkosh closed 3 years ago
I can confirm this, have the same issue:
ValueError: time data 'Sat, 20 Feb 2021 16:09:12 GMT' does not match format '%a, %d %b %Y %H:%M:%S %z'
I've used the following fix:
import dateutil as dateparser
.....
parsed_message_date = dateparser.parse(sanitised_date)
(line 116)
In my case that was few different date formats that caused this error and dateutil library deals with all of them. Just submitted a PR that should fix this.
Hi, Below is the error after reading about 25 emails. I am reading about 39K emails on an AOL imap server. It appear to fail when it hits an email with an attachment. I tried to edit line 118 to match the date format within AOL but could not get the system to download the attached file. Do you have any thoughts on why this may be happing? This looks like a great script and would love to see it collect all the files within my email. Thanks
_Traceback (most recent call last): File "C:\python382\Scripts\attachment-downloader.py", line 118, in
parsed_message_date = datetime.datetime.strptime(sanitised_date, '%a, %d %b %Y %H:%M:%S %z')
File "c:\python382\lib_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "c:\python382\lib_strptime.py", line 349, in strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '10 Feb 2018 18:11:48 +0000' does not match format '%a, %d %b %Y %H:%M:%S %z'