Registration module for python reports wrong timezone under cygwin

I am running a python script that uses the cygwin registration module on Windows 7. The command datereports the correct time:

$ date
Tue, Aug 14, 2012  2:47:49 PM

However, the python script shuts down after five hours:

2012-08-14 19:39:06,438: Done!

I do nothing when I configure logging for the script:

logging.basicConfig(format='%(asctime)-15s: %(message)s', level=logging.DEBUG)

Can someone tell me what is happening and how can I fix it?

+5
source share
2 answers

You need to disable the "TZ" environment in your python script before importing date and time modules. It is set by cygwin but not understood by Windows:

if os.getenv("TZ"):
    os.unsetenv("TZ")
+8
source

, TZ , Python Cygwin GMT ​​(UTC). , TZ , Windows!

unset TZ bash Python, Python Windows. ENV Python , Python ( os.environ['TZ'] Python , , , import os , , "Cygwin/Python", UTC?).

, unset TZ .bash_profile ( /home/<user>, , Cygwin).

+3

All Articles