Skip to content

Instantly share code, notes, and snippets.

def status_worker(body, last_modify):
try:
expire = time.time() + 10
while time.time() < expire:
mtime = os.path.getmtime(STATUS_FILE)
if mtime > last_modify:
break
time.sleep(1)
if not os.path.exists(STATUS_FILE):
body.put(json.dumps({
@xebecnan
xebecnan / win32_utf8_run.py
Last active December 27, 2015 20:49
Windows下正确显示程序打印的UTF8中文
import sys
from subprocess import PIPE, Popen, STDOUT
args = sys.argv[1:]
process = Popen(args, stdout=PIPE, shell=True, stderr=STDOUT)
count = 0
while True:
buff = process.stdout.readline()