import subprocess from subprocess import SubprocessError, TimeoutExpired, CalledProcessError import platform class Sra: def __init__(self, file_path, output_file_path): """ SRA class :param file_path: _sra.xml file path :param output_file_path: path to output the sra calculation """ self._file_path = file_path self._output_file_path = output_file_path if platform.system() == 'Linux': self._executable = 'citysim_sra' elif platform.system() == 'Windows': self._executable = 'shortwave_integer' 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)