From 0eaf2431e1ea4e5aabb599d381bff7e71ae69fe9 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Sat, 19 Jan 2013 01:34:01 +0100 Subject: [PATCH] Properly split exception reports into lines. --- pdm/srv.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pdm/srv.py b/pdm/srv.py index 8eb11f5..b2c131a 100644 --- a/pdm/srv.py +++ b/pdm/srv.py @@ -61,8 +61,10 @@ class repl(object): self.echo(eval(ccode, self.mod.__dict__)) self.cl.send("+OK\n") except: - for line in traceback.format_exception(*sys.exc_info()): - self.cl.send(" " + line) + lines = ("".join(traceback.format_exception(*sys.exc_info()))).split("\n") + while len(lines) > 0 and lines[-1] == "": lines = lines[:-1] + for line in lines: + self.cl.send(" " + line + "\n") self.cl.send("+EXC\n") def handle(self, buf): -- 2.11.0