You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was extracting Date from e-mail headers, when I came across this:
importmayaemail_date='Tue, 22 May 2018 16:37:09 +01:00 (BST)'print(maya.parse(email_date).datetime())
Output:
(kevin) kevin@dual:~/git/oldMail/sandbox$ python sand-001.py
Traceback (most recent call last):
File "sand-001.py", line 8, in <module>
print(maya.parse(email_date).datetime())
File "/home/kevin/.local/share/virtualenvs/kevin-QvQG5PMg/lib/python3.7/site-packages/maya/core.py", line 766, in parse
dt = pendulum.parse(str(string), **options)
File "/home/kevin/.local/share/virtualenvs/kevin-QvQG5PMg/lib/python3.7/site-packages/pendulum/parser.py", line 29, in parse
return _parse(text, **options)
File "/home/kevin/.local/share/virtualenvs/kevin-QvQG5PMg/lib/python3.7/site-packages/pendulum/parser.py", line 56, in _parse
tz=parsed.tzinfo or options.get("tz", UTC),
File "/home/kevin/.local/share/virtualenvs/kevin-QvQG5PMg/lib/python3.7/site-packages/pendulum/__init__.py", line 111, in datetime
tz = _safe_timezone(tz)
File "/home/kevin/.local/share/virtualenvs/kevin-QvQG5PMg/lib/python3.7/site-packages/pendulum/__init__.py", line 82, in _safe_timezone
elif obj.tzname(None) == "UTC":
File "/home/kevin/.local/share/virtualenvs/kevin-QvQG5PMg/lib/python3.7/site-packages/dateutil/tz/tz.py", line 238, in tzname
return self._tznames[self._isdst(dt)]
File "/home/kevin/.local/share/virtualenvs/kevin-QvQG5PMg/lib/python3.7/site-packages/dateutil/tz/tz.py", line 291, in _isdst
dstval = self._naive_is_dst(dt)
File "/home/kevin/.local/share/virtualenvs/kevin-QvQG5PMg/lib/python3.7/site-packages/dateutil/tz/tz.py", line 259, in _naive_is_dst
timestamp = _datetime_to_timestamp(dt)
File "/home/kevin/.local/share/virtualenvs/kevin-QvQG5PMg/lib/python3.7/site-packages/dateutil/tz/tz.py", line 1814, in _datetime_to_timestamp
return (dt.replace(tzinfo=None) - EPOCH).total_seconds()
AttributeError: 'NoneType' object has no attribute 'replace'
Issues:
BST is not supported, but (GMT, CET, CEDT...) are
There is no error handling for Time Zone Abbreviations
The text was updated successfully, but these errors were encountered:
I was extracting Date from e-mail headers, when I came across this:
Output:
Issues:
BST is not supported, but (GMT, CET, CEDT...) are
There is no error handling for Time Zone Abbreviations
The text was updated successfully, but these errors were encountered: