【发布时间】:2012-08-09 23:33:12
【问题描述】:
Welp,我需要从 python 中删除一些巨大的临时目录,但我似乎无法使用 rm -r。我正在考虑一个大数据集(在 s3 上)我没有磁盘空间来放置它们。
我从 python 调用命令的通常方式是
import subprocess
subprocess.call('rm','-r','/home/nathan/emptytest')
这给了我
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 493, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 629, in __init__
raise TypeError("bufsize must be an integer")
TypeError: bufsize must be an integer
这是怎么回事?
【问题讨论】:
标签: python shell exception subprocess rm