On Fri, Dec 23, 2016 at 2:27 PM, Skip Montanaro <skip.montan...@gmail.com> wrote: >> I need to compare these datetimes, and if I do that I get the dreaded >> "can't compare offset-naive and offset-aware datetimes" error. > > If you're sure the naive datetimes are UTC, this should work: > > import pytz > > dt = pytz.utc.localize(dateutil.parser.parse('2016-04-27T00:00:00')) > > You can then compare it with other tz-containing datetime objects.
I did mess around with pytz a bit but I was getting a lot of exceptions - something related to the TZ already being set or something like that. I don't recall exactly, and I can't scroll back far enough to find it. -- https://mail.python.org/mailman/listinfo/python-list