我想为 pdf 文件运行pdftohtml并将其输出写入 /dev/stdout 或允许我直接从subprocess
.
我的代码:
cmd = ['pdftohtml', '-c', '-s', '-i', '-fontfullname', filename, '-stdout', '/dev/stdout']
result = subprocess.run(cmd, stdout=PIPE, stderr=STDOUT, text=True)
上面的代码以代码 -11 退出。
我在 WSL 2 中使用 Ubuntu 18.04 运行它。
我尝试在 bash 中执行相同的命令:
[1] 14041 segmentation fault (core dumped) pdftohtml -c -s -i -fontfullname -stdout /dev/stdout
也不能将“-”传递给标准输出值。
我该怎么做才能直接从 html 输出subprocess.run
?
我知道可以通过管道将cat
文件名输出到命令,但这不是我想要的。
该解决方案必须与 WSL2 和 python 拉伸 docker 映像兼容。但是,任何澄清都会有所帮助:)