+ (type, value, tb) = sys.exc_info()
+ lines = []
+
+ # Create error message
+ for line in traceback.format_exception_only(type, value):
+ lines.append(unicode(line))
+ lines.append("\n")
+
+ # Create stacktrace
+ trace = traceback.extract_tb(tb)
+ trace.reverse()
+
+ basedir = os.path.dirname(__file__) + os.sep
+ for (file, line, func, code) in trace:
+ # Remove the basedir from any filename, since it is not so
+ # interesting but takes up precious space.
+ if file.startswith(basedir):
+ file = file[len(basedir):]
+ lines.append(u'\n%s:%s\nin %s:\n%s\n' % (file, line, func, code))
+
+ # Create and fill an error dialog