import subprocess from subprocess import SubprocessError, TimeoutExpired, CalledProcessError import glob class Meb: def __init__(self, file_path): """ SRA class :param file_path: insel file path """ self._file_path = file_path self._executable = 'insel' def run(self): """ Calls the software """ try: _insel_files = glob.glob(f'{self._file_path}/*.insel') for insel_file in _insel_files: subprocess.run([self._executable, str(insel_file)], stdout=subprocess.DEVNULL) except (SubprocessError, TimeoutExpired, CalledProcessError) as error: raise Exception(error)