From 19ae5d63129d4a33612b6016b145bb77d9b1b0ac Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sat, 17 May 2014 15:55:03 +0200 Subject: [PATCH] add linesep to output content if file is not sys.stdout (closes #1383) --- weboob/tools/application/formatters/iformatter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/weboob/tools/application/formatters/iformatter.py b/weboob/tools/application/formatters/iformatter.py index 36266c7e..129e808a 100644 --- a/weboob/tools/application/formatters/iformatter.py +++ b/weboob/tools/application/formatters/iformatter.py @@ -107,7 +107,7 @@ class IFormatter(object): def output(self, formatted): if self.outfile != sys.stdout: with open(self.outfile, "a+") as outfile: - outfile.write(formatted.encode('utf-8')) + outfile.write(formatted.encode('utf-8') + os.linesep) else: for line in formatted.split('\n'): @@ -216,7 +216,7 @@ class PrettyFormatter(IFormatter): self.colored(title, 'yellow', 'bold')) if desc is not None: - result += u'\n\t%s' % self.colored(desc, 'white') + result += u'%s\t%s' % (os.linesep, self.colored(desc, 'white')) return result