import sys import helper, market args = helper.main_parse_args(sys.argv[1:]) pg_config, report_path = helper.main_parse_config(args.config) for market_config, user_id in helper.main_fetch_markets(pg_config, args.user): try: user_market = market.Market.from_config(market_config, debug=args.debug) helper.main_process_market(user_market, args.action, before=args.before, after=args.after) except Exception as e: try: user_market.report.log_error("main", exception=e) except: print("{}: {}".format(e.__class__.__name__, e)) finally: helper.main_store_report(report_path, user_id, user_market)