35 lines
779 B
Python
35 lines
779 B
Python
import getopt
|
|
import sys
|
|
import yaml
|
|
|
|
from data_processor import DataProcessor
|
|
|
|
config_name = 'config.yml'
|
|
|
|
options = "hc:"
|
|
long_options = ["help", "config="]
|
|
|
|
argumentList = sys.argv[1:]
|
|
arguments, values = getopt.getopt(argumentList, options, long_options)
|
|
|
|
for currentArgument, currentValue in arguments:
|
|
|
|
if currentArgument in ("-h", "--help"):
|
|
print("reader.py [--config=path/to/config.yml]")
|
|
|
|
sys.exit(0)
|
|
|
|
elif currentArgument in ("-c", "--config"):
|
|
config_name = currentValue
|
|
|
|
with open(config_name) as f:
|
|
config = yaml.load(f, Loader=yaml.FullLoader)
|
|
|
|
print("config: ", config)
|
|
|
|
try:
|
|
processor = DataProcessor(config)
|
|
processor.run()
|
|
except Exception as err:
|
|
print('Command processor serious error: ', err)
|
|
sys.exit(1)
|