Skip to content

Commit

Permalink
Use warnings.warn instead of logging.warn when loading Problem from H…
Browse files Browse the repository at this point in the history
…DF5 without an Objective

Allows using warnings filter to get rid of this message.
  • Loading branch information
dweindl committed Jan 15, 2024
1 parent 1c5580d commit 4361f6b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pypesto/store/read_from_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import ast
import logging
import warnings
from pathlib import Path
from typing import Union

Expand Down Expand Up @@ -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, [], [])

Expand Down

0 comments on commit 4361f6b

Please sign in to comment.