py4e
py4e copied to clipboard
gmodel.py: UnknownTimezoneWarning: tzname EDT identified but not understood
https://github.com/csev/py4e/blob/17b09f86773f96456a7d7e66cd1540b8294e0067/code3/gmane/gmodel.py#L59-L60
In Python 3.8.2 these lines cause a warning:
/usr/lib/python3/dist-packages/dateutil/parser/_parser.py:1199: UnknownTimezoneWarning: tzname EDT identified but not understood. Pass `tzinfos` argument in order to correctly return a timezone-aware datetime. In a future version, this will raise an exception.
warnings.warn("tzname {tzname} identified but not understood. "
This can be patched like this:
if md.endswith('EDT'):
md = md.replace('EDT','-0400')
pdate = parser.parse(md)
test_at = pdate.isoformat()
or like:
if md.endswith('EDT'):
md = md[:-3] + '-0400'
pdate = parser.parse(md)
test_at = pdate.isoformat()
Is explicitly replacing the last 3 symbols better?