From 4361f6b2fe97b85cbb9ad40105276012fa2b7fde Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Sat, 16 Dec 2023 11:48:57 +0100 Subject: [PATCH] Use warnings.warn instead of logging.warn when loading Problem from HDF5 without an Objective Allows using warnings filter to get rid of this message. --- pypesto/store/read_from_hdf5.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pypesto/store/read_from_hdf5.py b/pypesto/store/read_from_hdf5.py index 6f555466f..a34cadf64 100644 --- a/pypesto/store/read_from_hdf5.py +++ b/pypesto/store/read_from_hdf5.py @@ -2,6 +2,7 @@ import ast import logging +import warnings from pathlib import Path from typing import Union @@ -120,10 +121,9 @@ def read(self, objective: ObjectiveBase = None) -> Problem: if objective is None: objective = Objective() # raise warning that objective is not loaded. - logger.info( - 'WARNING: You are loading a problem.\nThis problem' - ' is not to be used without a separately created' - ' objective.' + warnings.warn( + 'You are loading a problem. This problem is not to be used ' + 'without a separately created objective.' ) problem = Problem(objective, [], [])