0
下面的代碼工作得很好。但是,一旦子進程被調用並且外部python腳本被執行,它將開始快速彈出命令提示符,因爲腳本的輸出是純文本。但是,我們已經嘗試了所有功能來禁用彈出窗口。我們嘗試添加'shell = False'和'shell = None'。我們甚至試圖編輯外部腳本本身並修改它的子進程調用,但它沒有。Python子進程造成延遲與殼
if os.path.exists(oldpath): shutil.copy(root.wgetdir + "\\" + root.website.get() + "\\" + item, keyworddir + "\\" + item)
shellreturn = subprocess.check_output(["C:\Python34\python",root.wgetdir + "\html2text.py", keyworddir + "\\" + item])
print(shellreturn)
shelllist = shellreturn.decode().splitlines()
使用'r「C:\ Python \ n \ f」'而不是'「C:\ Python \ n \ f」'。後者在其中有字面換行('「\ n」')。使用'os.path.join(keyworddir,item)'而不是'keyworddir +「\\」+ item' – jfs