use subprocess.call to call ocr (#4448)
parent
b4367e4386
commit
7139a92d25
|
@ -41,8 +41,10 @@ def process(cfg, filename, payload, enable_ocr=True):
|
|||
os.write(fd, payload)
|
||||
os.close(fd)
|
||||
print >> sys.stderr, ' running OCR on file'
|
||||
os.system('abbyyocr9 -rl French -if %s -f PDF -pem ImageOnText -pfpr 150 -pfq 100 -of %s' % \
|
||||
(tmpfilename, ocr_filename))
|
||||
subprocess.call(['/opt/ABBYYOCR9/abbyyocr9',
|
||||
'-rl', 'French', '-if', tmpfilename,
|
||||
'-f', 'PDF', '-pem', 'ImageOnText', '-pfpr', '150',
|
||||
'-pfq', '100', '-of', ocr_filename])
|
||||
if not os.path.exists(ocr_filename):
|
||||
print >> sys.stderr, 'failed to OCR %s' % filename
|
||||
file('/tmp/' + filename, 'w').write(payload) # keep it for inspection
|
||||
|
|
Reference in New Issue