summaryrefslogtreecommitdiffstats
path: root/ocrloader.py
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2013-10-10 11:36:45 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2013-10-10 11:36:45 (GMT)
commit112e100502d5c5d8896d1331c15fe338c25ef57b (patch)
tree382e9816f72331bf01fd223233a0a1e3354e1ff5 /ocrloader.py
parenta8f358bcd5ea16f32ff4232a02dc5bd813345f34 (diff)
downloadpfwbged.ocrloader-112e100502d5c5d8896d1331c15fe338c25ef57b.zip
pfwbged.ocrloader-112e100502d5c5d8896d1331c15fe338c25ef57b.tar.gz
pfwbged.ocrloader-112e100502d5c5d8896d1331c15fe338c25ef57b.tar.bz2
add a --config command line option
Diffstat (limited to 'ocrloader.py')
-rw-r--r--ocrloader.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/ocrloader.py b/ocrloader.py
index 3ce9ea0..2120e94 100644
--- a/ocrloader.py
+++ b/ocrloader.py
@@ -11,6 +11,14 @@ import sys
import tempfile
import time
+import argparse
+parser = argparse.ArgumentParser()
+parser.add_argument('--config', default='ocrloader.ini')
+args = parser.parse_args()
+
+config_filepath = args.config
+
+
import logging
logging.basicConfig(level=logging.DEBUG)
def process(cfg, filename, payload, enable_ocr=True):
@@ -73,7 +81,7 @@ def process(cfg, filename, payload, enable_ocr=True):
while True:
cfg = ConfigParser.ConfigParser()
- cfg.read('ocrloader.ini')
+ cfg.read(config_filepath)
for section in cfg.sections():
print 'processing', section
imap_server = cfg.get(section, 'imap_server')