From 8ed5def21c30df5e98c22b34d863862bbc4be21b Mon Sep 17 00:00:00 2001 From: Laurie Clark-Michalek Date: Sun, 12 Jun 2011 17:06:29 +0100 Subject: Fixed locale issue with decimal point. --- archey3 | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/archey3 b/archey3 index 7a144ed..9fb6b58 100755 --- a/archey3 +++ b/archey3 @@ -227,9 +227,16 @@ class fsDisplay(display): raise def format_output(self, instring): + try: + decimal_point = self.call_command( + 'locale -ck decimal_point').split('\n')[1].split('=')[1] + except Exception as e: + self.logger.warning('Could not determine locale decimal point,' + + 'defaulting to \'.\', failed with error {0}'.format(e)) + decimal_point = '.' values = [line for line in instring.split('\n') if line][1].split() - used = values[3] - total = values[2] + used = values[3].replace(decimal_point, '.') + total = values[2].replace(decimal_point, '.') fstype = values[1] conversion_type = self.config.get('fs', 'unit', fallback="si").lower() conversions = self.conversions[conversion_type] -- cgit v1.2.3-54-g00ecf