diff --git a/openml/config.py b/openml/config.py index a39b72d48..9e2e697d5 100644 --- a/openml/config.py +++ b/openml/config.py @@ -231,15 +231,6 @@ def _get(config, key): connection_n_retries = int(_get(config, "connection_n_retries")) max_retries = int(_get(config, "max_retries")) - if cache_exists: - _create_log_handlers() - else: - _create_log_handlers(create_file_handler=False) - openml_logger.warning( - "No permission to create OpenML directory at %s! This can result in OpenML-Python " - "not working properly." % config_dir - ) - cache_directory = os.path.expanduser(short_cache_dir) # create the cache subdirectory if not os.path.exists(cache_directory): @@ -251,6 +242,15 @@ def _get(config, key): "OpenML-Python not working properly." % cache_directory ) + if cache_exists: + _create_log_handlers() + else: + _create_log_handlers(create_file_handler=False) + openml_logger.warning( + "No permission to create OpenML directory at %s! This can result in OpenML-Python " + "not working properly." % config_dir + ) + if connection_n_retries > max_retries: raise ValueError( "A higher number of retries than {} is not allowed to keep the "