【发布时间】:2020-07-28 08:54:10
【问题描述】:
感谢您帮助我。
我正在尝试从 python 运行 antiword 以将 .docx 转换为 .doc。我已经为任务使用了子流程。
import subprocess
test = subprocess.Popen(["antiword","/home/mypath/document.doc",">","/home/mypath/document.docx"], stdout=subprocess.PIPE)
output = test.communicate()[0]
但它返回错误,
I can't open '>' for reading
I can't open '/home/mypath/document.docx' for reading
但是同样的命令在终端中也可以工作
antiword /home/mypath/document.doc > /home/mypath/document.docx
我做错了什么?
【问题讨论】:
标签: python python-3.x doc