From 6467d3b58e29c15157be6b264a55acefeb89f406 Mon Sep 17 00:00:00 2001 From: hroff-1902 Date: Mon, 6 May 2019 18:27:05 +0300 Subject: [PATCH] check python version --- freqtrade/main.py | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/freqtrade/main.py b/freqtrade/main.py index 877e2921d..79d150441 100755 --- a/freqtrade/main.py +++ b/freqtrade/main.py @@ -22,21 +22,28 @@ def main(sysargv: List[str]) -> None: This function will initiate the bot and start the trading loop. :return: None """ - arguments = Arguments( - sysargv, - 'Free, open source crypto trading bot' - ) - args: Namespace = arguments.get_parsed_arg() - - # A subcommand has been issued. - # Means if Backtesting or Hyperopt have been called we exit the bot - if hasattr(args, 'func'): - args.func(args) - return - - worker = None - return_code = 1 try: + worker = None + return_code = 1 + + # check min. python version + if sys.version_info < (3, 6): + raise SystemError("Freqtrade requires Python version >= 3.6") + + arguments = Arguments( + sysargv, + 'Free, open source crypto trading bot' + ) + args: Namespace = arguments.get_parsed_arg() + + # A subcommand has been issued. + # Means if Backtesting or Hyperopt have been called we exit the bot + if hasattr(args, 'func'): + args.func(args) + # TODO: fetch return_code as returned by the command function here + return_code = 0 + return + # Load and run worker worker = Worker(args) worker.run() @@ -47,8 +54,8 @@ def main(sysargv: List[str]) -> None: except OperationalException as e: logger.error(str(e)) return_code = 2 - except BaseException: - logger.exception('Fatal exception!') + except BaseException as e: + logger.exception('Fatal exception! ' + str(e)) finally: if worker: worker.exit()