Created
May 22, 2017 09:27
-
-
Save alanfranz/40aba4f62e439164a992fda1133ad556 to your computer and use it in GitHub Desktop.
python timezone information error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import time | |
# The following is a file in /usr/share/zoneinfo | |
os.environ["TZ"] = "Europe/Rome" | |
time.tzset() | |
import sys | |
print sys.version_info | |
import commands | |
print "System time: %s" % commands.getoutput("date --rfc-3339=seconds") | |
import logging | |
import datetime | |
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout, | |
format="%(asctime)s:" + logging.BASIC_FORMAT, | |
datefmt="%Y-%m-%dT%H:%M:%S%z") | |
logger = logging.getLogger() | |
logger.info("Something happened") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Verified that
/usr/share/zoneinfo/Europe/Rome
exists.Output on Ubuntu Xenial:
Output on Ubuntu Trusty: