I am trying to convert UTC time to local time zone using below code. it's working fine on ubuntu 18.04. But getting an error in windows 10. Because tz.gettz() return None.
In command prompt getting below error:
astimezone() argument 1 must be datetime.tzinfo, not None.
Here is the code:
from dateutil import tz
def convert_to_localtz(self,date):
    tz1 = self._context.get('tz')// Value is 'Asia/Calcutta'
    to_zone = tz.gettz(tz1)
    print'to_zone',to_zone // Prints None
    from_zone = tz.tzutc()
    utc = date.replace(tzinfo=from_zone)
    date = utc.astimezone(to_zone)
    return date
Installed python version is 3.7
How can i resolve this?
 
     
    