From a6afec984fef5c65a30ab89d6e4e438921dde936 Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Tue, 17 May 2016 18:02:16 +0100 Subject: [PATCH] Fixed catching of ValueError in messagebox_on_error, and fix D3PO export in Python 3 --- CHANGES.md | 4 ++++ glue/plugins/export_d3po.py | 6 +++--- glue/utils/qt/decorators.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index d4b13d911..28e8f9d12 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -27,6 +27,10 @@ v0.8 (unreleased) functions by default, and expressions are tested on-the-fly to check that there are no issues with syntax or undefined variables. [#956] +* Fixed D3PO export when using Python 3. + +* Fixed display of certain error messages when using Python 3. + v0.7.3 (2015-05-04) ------------------- diff --git a/glue/plugins/export_d3po.py b/glue/plugins/export_d3po.py index a13e048eb..90a36b112 100644 --- a/glue/plugins/export_d3po.py +++ b/glue/plugins/export_d3po.py @@ -136,7 +136,7 @@ def can_save_d3po(application): for tab in application.viewers: for viewer in tab: - if not isinstance(viewer, DISPATCH.keys()): + if not isinstance(viewer, tuple(DISPATCH.keys())): raise ValueError("D3PO Export only supports scatter " "and histogram plots") if sum(len(tab) for tab in application.viewers) == 0: @@ -219,8 +219,8 @@ def launch(path): :param path: The TLD of the bundle """ - from SocketServer import TCPServer - from SimpleHTTPServer import SimpleHTTPRequestHandler + from glue.external.six.moves.socketserver import TCPServer + from glue.external.six.moves.SimpleHTTPServer import SimpleHTTPRequestHandler from random import randrange from socket import error import webbrowser diff --git a/glue/utils/qt/decorators.py b/glue/utils/qt/decorators.py index ce717bd0a..41c004197 100644 --- a/glue/utils/qt/decorators.py +++ b/glue/utils/qt/decorators.py @@ -37,7 +37,7 @@ def wrapper(*args, **kwargs): try: return func(*args, **kwargs) except Exception as e: - m = "%s\n%s" % (msg, e.message) + m = "%s\n%s" % (msg, e.args[0]) detail = str(traceback.format_exc()) qmb = QMessageBox(QMessageBox.Critical, "Error", m) qmb.setDetailedText(detail)