2017-09-22 40 views
0

我有一個程序,它可以在Linux上完美運行,但是 - 這是一個奇蹟 - 而不是Windows。 我已經修復的bug一個用SYS,並獲得一個新問題:Python + Windows:子進程和bufsize

"TypeError: bufsize must be an integer" 

我敢肯定這是一件很容易的,我忘了試戴任何提示?謝謝!

import subprocess 
import sys 
process = subprocess.Popen(sys.executable, [player["progname"]], 
      stdin=subprocess.PIPE, 
      stdout=subprocess.PIPE, 
      universal_newlines=True) 
+0

可能的複製[刷新消息時,bufsize必須是整數錯誤](https://stackoverflow.com/questions/17824096/bufsize-must-be-an-integer-error-while-grepping-a-message) –

回答

0

你可能想換都sys.executableplayer["progname"]list

process = subprocess.Popen([sys.executable, player["progname"]], 
      ...) 

否則,你傳遞player["progname"]bufsize參數的構造函數POPEN(https://docs.python.org/3/library/subprocess.html#popen-constructor

+0

非常感謝你 - 它的工作原理...你是完全正確的,我必須包括sys.exe可執行文件! – Ayumika

0

POPEN構造函數的第二個參數應該是一個整數,你逝去的[player["progname"]]