diff --git a/pynxtools/dataconverter/readers/xrd/reader.py b/pynxtools/dataconverter/readers/xrd/reader.py index 000474dab..c9c2fe730 100644 --- a/pynxtools/dataconverter/readers/xrd/reader.py +++ b/pynxtools/dataconverter/readers/xrd/reader.py @@ -52,7 +52,7 @@ # } REPLACE_NESTED: Dict[str, str] = {} -XRD_FILE_EXTENSIONS = [".xrdml", ".udf", ".raw", ".xye"] +XRD_FILE_EXTENSIONS = [".xrdml", "xrdml", ".udf", ".raw", ".xye"] def get_template_from_nxdl_name(nxdl_name): @@ -89,7 +89,7 @@ def get_template_from_nxdl_name(nxdl_name): if root is None and full_nxdl_path.exists(): root = ET.parse(full_nxdl_path).getroot() else: - full_nxdl_path = (def_path, 'base_classes', nxdl_file) + full_nxdl_path = Path(def_path, 'base_classes', nxdl_file) if root is None and full_nxdl_path.exists(): root = ET.parse(full_nxdl_path).getroot() @@ -120,9 +120,12 @@ def read(self, template: dict = None, file_paths: Tuple[str] = None, objects: Tuple[Any] = None): + """General read menthod to prepare the template. """ - General read menthod to prepare the template. - """ + + if not isinstance(file_paths, tuple) and not isinstance(file_paths, list): + file_paths = (file_paths,) + print(' input files: ', file_paths) filled_template: Union[Dict, None] = Template() eln_dict: Union[Dict[str, Any], None] = None config_dict: Dict = {} @@ -130,6 +133,7 @@ def read(self, xrd_file_ext: str = "" for file in file_paths: ext = "".join(Path(file).suffixes) + print('file extension: ', ext) if ext == '.json': with open(file, mode="r", encoding="utf-8") as fl_obj: config_dict = json.load(fl_obj) @@ -147,7 +151,7 @@ def read(self, xrd_dict = parse_and_convert_file(file) # Feeding xrd data from xrdml type file - if xrd_file_ext == ".xrdml": + if xrd_file_ext in [".xrdml", "xrdml"]: feed_xrdml_to_template(template, xrd_dict, config_dict, eln_dict) # Feeding xrd data from udf type file elif xrd_file_ext == ".udf":