From d53d0a77cfff807df935fe1739757191b12c5cf5 Mon Sep 17 00:00:00 2001 From: uccu Date: Tue, 17 May 2022 00:53:29 +0800 Subject: [PATCH] fix: use ruamel instead of yaml --- compose_viz/parser.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compose_viz/parser.py b/compose_viz/parser.py index 8e24687..9b4e892 100644 --- a/compose_viz/parser.py +++ b/compose_viz/parser.py @@ -1,7 +1,7 @@ from re import S from compose_viz.compose import Compose from compose_viz.compose import Service -import yaml +from ruamel.yaml import YAML class Parser: @@ -13,9 +13,10 @@ class Parser: # load the yaml file with open(file_path, "r") as f: try: - yaml_data = yaml.safe_load(f) - except yaml.YAMLError as exc: - raise yaml.YAMLError + yaml = YAML() + yaml_data = yaml.load(f) + except YAML.YAMLError as exc: + raise YAML.YAMLError # validate the yaml file if not yaml_data: print("Error: empty yaml file")