0

I have a python script to read the news RSS feed and extract the current news. I am using datatime.now() to get the current date and extract the article for the same date. I am now getting this TimeZone Warning, and articles are being extracted for wrong dates. Any solution to overcome this??

UnknownTimezoneWarning: tzname IST 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. "

  • 1
    `IST` is ambiguous, check e.g. https://www.timeanddate.com/time/zones/ist and you'll find at least 3 different timezones that can be abbreviated as "IST". To avoid the warning, use a specific timezone like 'Asia/Kolkata' in case you want 'Indian Standard Time'. – FObersteiner May 23 '20 at 10:41
  • to make this question more helpful to others, could you add an example of a date/time string you parse? how is the timezone handled? Also note that `datetime.now()` returns *local* time, although the tzinfo property is None (naive datetime object). If you rely in correct handling of timezones, work with UTC (with timezone-aware datetime objects). – FObersteiner May 23 '20 at 10:46

0 Answers0