import subprocess from subprocess import SubprocessError, TimeoutExpired, CalledProcessError import platform class EP: def __init__(self, file_path, output_file_path): """ SRA class :param file_path: .idf file path :param output_file_path: path to output the energyplus calculation """ self._file_path = file_path self._output_file_path = output_file_path if platform.system() == 'Linux': self._executable = 'energyplus' elif platform.system() == 'Windows': self._executable = 'energyplus' def run(self): """ Calls the software """ try: subprocess.run([self._executable, str(self._file_path)], stdout=subprocess.DEVNULL) except (SubprocessError, TimeoutExpired, CalledProcessError) as error: raise Exception(error)