0

I'm trying to get the output from this command: "hocr-pdf" so when I run this command in my command line it works perfectly well and this is how I type it:

hocr-pdf . > converted.pdf

in order for this command to work I must have in the working directory 2 files with these extensions (jpeg ,hocr) so when try to run this script containing this command It shows me this:

hocr-pdf: error: unrecognized arguments: gg

and this is my code:

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"])
hamma
  • 129
  • 2
  • 14

1 Answers1

1

As you use shell features , You should invoke the shell with the command:

p2=subprocess.check_call(["bash","-c","hocr-pdf .> gg"])
napuzba
  • 6,033
  • 3
  • 21
  • 32