From de020599d31d782a9dda40afeb662148df7448bd Mon Sep 17 00:00:00 2001 From: Nathan Baker Date: Mon, 30 Nov 2020 15:21:47 -0800 Subject: [PATCH] Raise error for ligand pKa errors. Fixes https://github.com/jensengroup/propka/pull/109#discussion_r532735233 per @orbeckst. --- propka/ligand_pka_values.py | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/propka/ligand_pka_values.py b/propka/ligand_pka_values.py index fd70a48..c642f65 100644 --- a/propka/ligand_pka_values.py +++ b/propka/ligand_pka_values.py @@ -163,23 +163,21 @@ class LigandPkaValues: [self.cxcalc, filename]+options.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() if len(errors) > 0: - _LOGGER.error( - '***********************************************************' - '*********************************************') - _LOGGER.error( - '* Error: Marvin execution failed: ' - ' *') - _LOGGER.error('* {0:<100s} *'.format(errors)) - _LOGGER.error( - '* ' - ' *') - _LOGGER.error( - '* Please edit the ligand mol2 file and re-run PropKa with ' - 'the -l option: {0:>29s} *'.format(filename)) - _LOGGER.error( - '***********************************************************' - '*********************************************') - sys.exit(-1) + err = ( + f'***********************************************************' + f'*********************************************' + f'* Error: Marvin execution failed: ' + f' *' + f'* {errors:<100s} *' + f'* ' + f' *' + f'* Please edit the ligand mol2 file and re-run PropKa with ' + f'the -l option: {filename:>29s} *' + f'***********************************************************' + f'*********************************************' + ) + _LOGGER.error(err) + raise OSError(err) # extract calculated pkas indices, pkas, types = self.extract_pkas(output) # store calculated pka values