Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Replace use of str() with six.text_type() for Py2&3 compatibility [backport to color_overhaul] #4278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/matplotlib/backends/backend_qt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _create_qApp():
if display is None or not re.search(':\d', display):
raise RuntimeError('Invalid DISPLAY variable')

qApp = QtWidgets.QApplication([str(" ")])
qApp = QtWidgets.QApplication([six.text_type(" ")])
qApp.lastWindowClosed.connect(qApp.quit)
else:
qApp = app
Expand Down Expand Up @@ -560,7 +560,7 @@ def destroy(self, *args):
self.window.close()

def get_window_title(self):
return str(self.window.windowTitle())
return six.text_type(self.window.windowTitle())

def set_window_title(self, title):
self.window.setWindowTitle(title)
Expand Down Expand Up @@ -733,7 +733,7 @@ def save_figure(self, *args):
self.canvas.print_figure(six.text_type(fname))
except Exception as e:
QtWidgets.QMessageBox.critical(
self, "Error saving file", str(e),
self, "Error saving file", six.text_type(e),
QtWidgets.QMessageBox.Ok, QtWidgets.QMessageBox.NoButton)


Expand Down Expand Up @@ -849,7 +849,7 @@ def exception_handler(type, value, tb):
if hasattr(value, 'strerror') and value.strerror is not None:
msg += value.strerror
else:
msg += str(value)
msg += six.text_type(value)

if len(msg):
error_msg_qt(msg)
Expand Down