summaryrefslogtreecommitdiffstats
path: root/ocrloader.py
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2014-03-12 11:37:02 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2014-03-12 11:37:02 (GMT)
commit7139a92d25e0ffd547b2148d91904667e89b8f6b (patch)
tree864dc3c32ab4dae96afabb426fef5d63848519fe /ocrloader.py
parentb4367e43861c1c8ac3bf6dd00fa2ec56e093071a (diff)
downloadpfwbged.ocrloader-7139a92d25e0ffd547b2148d91904667e89b8f6b.zip
pfwbged.ocrloader-7139a92d25e0ffd547b2148d91904667e89b8f6b.tar.gz
pfwbged.ocrloader-7139a92d25e0ffd547b2148d91904667e89b8f6b.tar.bz2
use subprocess.call to call ocr (#4448)
Diffstat (limited to 'ocrloader.py')
-rw-r--r--ocrloader.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/ocrloader.py b/ocrloader.py
index b34ebc4..5556304 100644
--- a/ocrloader.py
+++ b/ocrloader.py
@@ -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