im parsing some tweet's data from Twitter API using sixohsix library. Im trying to convert the date of the tweet to my locale:
from pytz import timezone
from dateutil import parser
timestamp = parser.parse(tweet["created_at"])
timestamp_arg = timestamp.astimezone(timezone('America/Buenos_Aires'))
and im getting a unicode warning:
dateutil\parser.py:339: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal elif res.tzname and res.tzname in time.tzname:
I've tried doing
parser.parse(str(tweet["created_at"]))
parser.parse(unicode(tweet["created_at"]).encode())
But nothing changes.
Besides the warning nothing seems to be broken. Does anyone know why is this happening, and how to fix it?
Thanks!
UPDATE:
I've tried the same example but hardcoding the time to string and that works without the warning. Also according to the warning msg the issue seems to happen in the parse call, in parser.py:339 when doing
res.tzname in time.tzname
maybe because res is unicode and time.tzname is not??