From 43031aa3bb61828b764bde099075c2213c855023 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 5 Dec 2018 20:44:41 +0100 Subject: [PATCH] Add missing path-error handler for hyperopt --- freqtrade/resolvers/hyperopt_resolver.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/freqtrade/resolvers/hyperopt_resolver.py b/freqtrade/resolvers/hyperopt_resolver.py index da7b65648..eb91c0e89 100644 --- a/freqtrade/resolvers/hyperopt_resolver.py +++ b/freqtrade/resolvers/hyperopt_resolver.py @@ -52,11 +52,14 @@ class HyperOptResolver(IResolver): abs_paths.insert(0, Path(extra_dir)) for _path in abs_paths: - hyperopt = self._search_object(directory=_path, object_type=IHyperOpt, - object_name=hyperopt_name) - if hyperopt: - logger.info('Using resolved hyperopt %s from \'%s\'', hyperopt_name, _path) - return hyperopt + try: + hyperopt = self._search_object(directory=_path, object_type=IHyperOpt, + object_name=hyperopt_name) + if hyperopt: + logger.info('Using resolved hyperopt %s from \'%s\'', hyperopt_name, _path) + return hyperopt + except FileNotFoundError: + logger.warning('Path "%s" does not exist', _path.relative_to(Path.cwd())) raise ImportError( "Impossible to load Hyperopt '{}'. This class does not exist"