openFile#

pyCGM2.Utils.files.openFile(path: str, filename: str)#

Open a JSON or YAML file and return its contents as a dictionary. It detects the file format based on its content.

Parameters:
  • path (str) – The directory path where the file is located.

  • filename (str) – The filename with extension.

Returns:

dict – The contents of the file.

Raises:

Exception – If the file is neither JSON nor YAML format.