Merge pull request #577 from gcarq/feature/fix-reference-before-assignment

fix reference before assignment error during shutdown
This commit is contained in:
Samuel Husso 2018-03-25 10:15:43 +03:00 committed by GitHub
commit a2c3df3ac5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,7 @@ def main(sysargv: List[str]) -> None:
# Means if Backtesting or Hyperopt have been called we exit the bot # Means if Backtesting or Hyperopt have been called we exit the bot
if hasattr(args, 'func'): if hasattr(args, 'func'):
args.func(args) args.func(args)
return 0 return
logger.info( logger.info(
'Starting freqtrade %s (loglevel=%s)', 'Starting freqtrade %s (loglevel=%s)',
@ -40,6 +40,8 @@ def main(sysargv: List[str]) -> None:
logging.getLevelName(args.loglevel) logging.getLevelName(args.loglevel)
) )
freqtrade = None
return_code = 1
try: try:
# Load and validate configuration # Load and validate configuration
configuration = Configuration(args) configuration = Configuration(args)
@ -53,11 +55,13 @@ def main(sysargv: List[str]) -> None:
except KeyboardInterrupt: except KeyboardInterrupt:
logger.info('SIGINT received, aborting ...') logger.info('SIGINT received, aborting ...')
return_code = 0
except BaseException: except BaseException:
logger.exception('Fatal exception!') logger.exception('Fatal exception!')
finally: finally:
if freqtrade:
freqtrade.clean() freqtrade.clean()
sys.exit(0) sys.exit(return_code)
def set_loggers() -> None: def set_loggers() -> None: