我使用了
1 process = subprocess.Popen(args, bufsize=1, stdout=subprocess.PIPE, close_fds=True, preexec_fn=os.setsid,universal_newlines=True)
這個需要一個導入一個包:
import subprocess
但是我不小心沒有加入這句話,而是導入一個我自己寫的模塊,
from common.comfunctions import *
而在改模塊中,我使用了,
import subprocess
這個導包。pycharm沒有提示錯誤,在跑程序的時候,
1 try: 2 process = subprocess.Popen(args, bufsize=1, stdout=subprocess.PIPE, close_fds=True, preexec_fn=os.setsid, 3 universal_newlines=True) 4 except Exception, e: 5 print "process is wrong!!!!!!" 6 try: 7 put_subprocess_to_queue_smoke(process, self.queue, self.env_name) 8 except Exception, e: 9 print "queue is wrong!!!!!"
報了一個錯:
queue is wrong!!!!!
后來,我直接使用導包跑程序,發現沒有錯誤了。雖然解決了這個錯誤,但是想不通為什么?后續繼續探討!
