subprocess 子进程管理

    module_base = pathlib.Path(__file__).absolute().parent.parent
    return_code = subprocess.call([config.python, '-m', 'link.db.operation', '-m', tmp_filename, tmp_out_filename], cwd=module_base)
    # return_code = subprocess.Popen([config.python, '-m', 'link.db.operation', '-m', tmp_filename, tmp_out_filename], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=module_base)
    # log("stage1_lsh_match_return_code: ",return_code.communicate())

 https://docs.python.org/zh-cn/3/library/subprocess.html

posted @ 2021-03-10 13:24  薄荷味日记  阅读(50)  评论(0编辑  收藏  举报