def open_log(temp_folder=g_temp):
    logfile = os.path.join(temp_folder, 'blender_render.log')
    try:
        os.remove(logfile)
    except OSError:
        pass
    open(logfile, 'a').close()
    old = os.dup(1)
    sys.stdout.flush()
    os.close(1)
    os.open(logfile, os.O_WRONLY)
    return old
def open_log(temp_folder=g_temp):
    logfile = os.path.join(temp_folder, 'blender_render.log')
    try:
        os.remove(logfile)
    except OSError:
        pass
    open(logfile, 'a').close()
    old = os.dup(1)
    sys.stdout.flush()
    os.close(1)
    os.open(logfile, os.O_WRONLY)
    return old