add a --config command line option
This commit is contained in:
parent
a8f358bcd5
commit
112e100502
10
ocrloader.py
10
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')
|
||||
|
|
Reference in New Issue