From da2f2f6cc0df1e4b89343b9e23fdc874d51469c4 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sat, 30 Jan 2010 17:09:12 +0100 Subject: [PATCH] [entropy.tools] fix print_exception frame data collection --- libraries/entropy/tools.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/entropy/tools.py b/libraries/entropy/tools.py index 4a81a46fc..987b31af2 100644 --- a/libraries/entropy/tools.py +++ b/libraries/entropy/tools.py @@ -221,18 +221,18 @@ def print_exception(returndata = False, tb_data = None, all_frame_data = False): frame.f_code.co_filename, frame.f_lineno)) for key, value in list(frame.f_locals.items()): - if not returndata: - sys.stdout.write("\t%20s = " % key) - else: - data.append("\t%20s = " % key,) + cur_str = '' + cur_str = "\t%20s = " % key try: - if not returndata: - sys.stdout.write(repr(value) + "\n") - else: - data.append(repr(value) + "\n") + cur_str += repr(value) + "\n" except: - if not returndata: - sys.stdout.write("\n") + cur_str += "\n" + + if not returndata: + sys.stdout.write(cur_str) + else: + data.append(cur_str) + if returndata: return data