【发布时间】:2013-06-18 08:08:59
【问题描述】:
我正在使用 python 2.6 版运行 Debian 6 挤压。我有两个这样的子流程代码:
rsync_out = subprocess.Popen(['sshpass', '-p', password, 'rsync', '--recursive', source],
stdout=subprocess.PIPE)
command = subprocess.check_call(('grep', '\.'), stdin=rsync_out.stdout)
它完全按照我想要的方式工作,但没有可用于 python 2.6 的 check_call。 subprocess.Popen如何调用第二条命令?
试过这样但没有用:
command = subprocess.Popen(['grep', '\.'], stdin=rsync_out.stdout).communicate()[0]
我收到此错误:
'NoneType' object has no attribute 'split'
【问题讨论】:
标签: python subprocess python-2.6