From cd8c0e7f02583849a276d387e56adbcec3edfb87 Mon Sep 17 00:00:00 2001 From: dalthviz Date: Mon, 6 Feb 2017 16:02:41 -0500 Subject: [PATCH] Adds a validation for the qtpy version and constructs the message dialog avoiding a crash. --- spyder/plugins/externalconsole.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/spyder/plugins/externalconsole.py b/spyder/plugins/externalconsole.py index c02b3f2c89f..7ee49b14e27 100644 --- a/spyder/plugins/externalconsole.py +++ b/spyder/plugins/externalconsole.py @@ -515,11 +515,19 @@ def start(self, fname, wdir=None, args='', interact=False, debug=False, if old_shell.is_running(): runconfig = get_run_configuration(fname) if runconfig is None or runconfig.show_kill_warning: - answer = QMessageBox.question(self, self.get_plugin_title(), - _("%s is already running in a separate process.\n" - "Do you want to kill the process before starting " - "a new one?") % osp.basename(fname), - QMessageBox.Yes | QMessageBox.Cancel) + if PYQT5: + answer = QMessageBox.question(self, self.get_plugin_title(), + _("%s is already running in a separate process.\n" + "Do you want to kill the process before starting " + "a new one?") % osp.basename(fname), + QMessageBox.Yes | QMessageBox.Cancel) + else: + mb = QMessageBox(self) + answer = mb.question(mb, self.get_plugin_title(), + _("%s is already running in a separate process.\n" + "Do you want to kill the process before starting " + "a new one?") % osp.basename(fname), + QMessageBox.Yes | QMessageBox.Cancel) else: answer = QMessageBox.Yes