Python 2.4.x這裏。Subprocess - Grep Broken Pipe
一直試圖讓子進程與glob一起工作。
嗯,這是問題區域。
def runCommands(thecust, thedevice):
thepath='/smithy/%s/%s' % (thecust,thedevice)
thefiles=glob.glob(thepath + '/*.smithy.xml')
p1=subprocess.Popen(["grep", "<record>"] + thefiles, stdout=subprocess.PIPE)
p2=subprocess.Popen(['wc -l'], stdin=p1.stdout, stdout=subprocess.PIPE)
p1.stdout.close()
thecount=p2.communicate()[0]
p1.wait()
我在屏幕上收到大量的「grep:writing output:Broken pipe」錯誤。
這是一些簡單的東西我錯過了,我只是不能發現它。任何想法?
預先感謝您。
有一對夫婦身邊子塔(非常漂亮)的包裝會使你的生活更容易像[PBS](https://github.com/amoffat/pbs很多)和[plumbum](https://github.com/tomerfiliba/plumbum)。 –
那些看起來非常酷 - 不幸的是,我不是在一個環境中,我可以在2.4的模塊之外添加模塊 – Chasester