Skip to content

Commit 42ae98c

Browse files
authored
More informative error on petab version mismatch (#165)
Closes #152.
1 parent 2bb9319 commit 42ae98c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/petab_gui/controllers/mother_controller.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import petab.v1 as petab
1111
import qtawesome as qta
1212
import yaml
13+
from petab.versions import get_major_version
1314
from PySide6.QtCore import QSettings, Qt, QTimer, QUrl
1415
from PySide6.QtGui import (
1516
QAction,
@@ -730,6 +731,12 @@ def open_yaml_and_load_files(self, yaml_path=None, mode="overwrite"):
730731
with open(yaml_path) as file:
731732
yaml_content = yaml.safe_load(file)
732733

734+
if (major := get_major_version(yaml_content)) != 1:
735+
raise ValueError(
736+
f"Only PEtab v1 problems are currently supported. "
737+
f"Detected version: {major}.x."
738+
)
739+
733740
# Resolve the directory of the YAML file to handle relative paths
734741
yaml_dir = Path(yaml_path).parent
735742

0 commit comments

Comments
 (0)