gpt4 book ai didi

python - 从 subprocess.check_call() 获取输出时出现问题

转载 作者:太空宇宙 更新时间:2023-11-04 10:19:13 28 4
gpt4 key购买 nike

<分区>

我正在尝试从这个命令中获取输出:“hocr-pdf”因此,当我在命令行中运行此命令时,它运行良好,这就是我键入它的方式:

hocr-pdf . > converted.pdf

为了使这个命令起作用,我必须在工作目录中有 2 个具有这些扩展名的文件(jpeg、hocr)所以当尝试运行包含此命令的脚本时,它向我展示了这一点:

hocr-pdf: error: unrecognized arguments: gg

这是我的代码:

from enter_filename import f2files
from f1fileOpen import f1file

from findPDF import OCRized
import subprocess





a =f1file()

if not OCRized(a):
p1=subprocess.check_call(["convert","-density","300",a,"-depth","8","converted.jpg"])
print "Conversion to jpg was successful"
p=subprocess.check_call(["tesseract","converted.jpg",'converted',"-l","eng","hocr"])
print "tesseract done the job"
p2=subprocess.check_call(["hocr-pdf",".>","gg"])
else:
p=subprocess.check_call(["tesseract",'1.png','f1',"-l","eng"])

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com