Launching python within python and timezone issue
        Posted  
        
            by 
                Gabi Purcaru
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Gabi Purcaru
        
        
        
        Published on 2011-01-14T19:17:47Z
        Indexed on 
            2011/01/14
            19:53 UTC
        
        
        Read the original article
        Hit count: 527
        
I had to make a launcher script for my django app, and it seems it somehow switches the timezone to GMT (default being +2), and every datetime is two hours behind when using the script. What could be causing that?
Here is the launcher script that I use:
#!/usr/bin/env python
import os
import subprocess
import shlex
import time
cwd = os.getcwd()
p1 = subprocess.Popen(shlex.split("python manage.py runserver"),
        cwd=os.path.join(cwd, "drugsworld"))
p2 = subprocess.Popen(shlex.split("python coffee_auto_compiler.py"),
        cwd=os.path.join(cwd))
try:
    while True:
        time.sleep(2)
except KeyboardInterrupt:
    p1.terminate()
    p2.terminate()
If I manually run python manage.py runserver, the timezone is +2. If, however, I use this script, the timezone is set to GMT.
© Stack Overflow or respective owner