[Python-checkins] cpython: Issue #27365: add chunk

terry.reedy python-checkins at python.org
Wed Jun 22 04:54:47 EDT 2016


https://hg.python.org/cpython/rev/3a122d0e4187
changeset:   102134:3a122d0e4187
user:        Terry Jan Reedy <tjreedy at udel.edu>
date:        Wed Jun 22 04:54:18 2016 -0400
summary:
  Issue #27365: add chunk

files:
  Lib/idlelib/textView.py |  14 +++++++++-----
  1 files changed, 9 insertions(+), 5 deletions(-)


diff --git a/Lib/idlelib/textView.py b/Lib/idlelib/textView.py
--- a/Lib/idlelib/textView.py
+++ b/Lib/idlelib/textView.py
@@ -4,7 +4,7 @@
 
 from tkinter import *
 from tkinter.ttk import Scrollbar
-import tkinter.messagebox as tkMessageBox
+from tkinter.messagebox import showerror
 
 class TextViewer(Toplevel):
     """A simple text viewer dialog for IDLE
@@ -73,10 +73,14 @@
     try:
         with open(filename, 'r', encoding=encoding) as file:
             contents = file.read()
-    except IOError:
-        tkMessageBox.showerror(title='File Load Error',
-                               message='Unable to load file %r .' % filename,
-                               parent=parent)
+    except OSError:
+        showerror(title='File Load Error',
+                  message='Unable to load file %r .' % filename,
+                  parent=parent)
+    except UnicodeDecodeError as err:
+        showerror(title='Unicode Decode Error',
+                  message=str(err),
+                  parent=parent)
     else:
         return view_text(parent, title, contents, modal)
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list