From 0a5fb38931fadf71b759d9e5a802226413d2f2ee Mon Sep 17 00:00:00 2001 From: wu Date: Wed, 10 Jan 2024 13:23:53 +0900 Subject: [PATCH] [euscollada/parseColladaBase.py] check PyYAML package version before using yaml.load function. (Loader needs to be explicitly indicated after PyYAML==5.4.1) --- euscollada/scripts/parseColladaBase.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/euscollada/scripts/parseColladaBase.py b/euscollada/scripts/parseColladaBase.py index 11cf878c..bf888665 100755 --- a/euscollada/scripts/parseColladaBase.py +++ b/euscollada/scripts/parseColladaBase.py @@ -407,7 +407,11 @@ class yamlParser: yaml_data = None def load(self, fname): - self.yaml_data = yaml.load(open(fname).read()) + from packaging import version + if version.parse(yaml.__version__) > version.parse('5.4.1'): + self.yaml_data = yaml.load(open(fname).read(), Loader=yaml.SafeLoader) + else: + self.yaml_data = yaml.load(open(fname).read()) def add_sensor(self, xml_obj): if 'sensors' in self.yaml_data and self.yaml_data['sensors']: