From 0ab8ff8aa4dbdb0e862ed3285634d8a788d6e93c Mon Sep 17 00:00:00 2001 From: Andrzej Bartoszek Date: Thu, 10 Oct 2024 13:41:18 +0200 Subject: [PATCH] Remove only asterisks from tables in output So it won't interfere with outputs printed with asterisks only (it happens when 6S is not able to print numbers according to the provided format). --- Py6S/outputs.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Py6S/outputs.py b/Py6S/outputs.py index ac6e0c2..3325266 100644 --- a/Py6S/outputs.py +++ b/Py6S/outputs.py @@ -121,17 +121,17 @@ def __dir__(self): def extract_results(self): """Extract the results from the text output of the model and place them in the ``values`` dictionary.""" - # Remove all of the *'s from the text as they just make it look pretty + # Remove all of the *'s forming tables in the text as they just make it look pretty # and get in the way of analysing the output - fulltext = self.fulltext.replace("*", "") + lines = [] + for orig_line in self.fulltext.splitlines(): + lines.append(orig_line.strip("*")) - # Split into lines - lines = fulltext.splitlines() # There should be hundreds of lines for a full 6S run - so if there are # less than 10 then it suggests something has gone seriously wrong if len(lines) < 10: - print(fulltext) + print(self.fulltext) raise OutputParsingError( "6S didn't return a full output. See raw 6S output above for " "more information and check for invalid parameter inputs"