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

Skip to content

Commit 870f09a

Browse files
author
Victor Stinner
committed
Issue #8203: Fix IDLE Credits dialog: view_file() uses its encoding argument.
1 parent 7c9627b commit 870f09a

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

Lib/idlelib/textView.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,7 @@ def view_text(parent, title, text):
6262

6363
def view_file(parent, title, filename, encoding=None):
6464
try:
65-
if encoding:
66-
import codecs
67-
textFile = codecs.open(filename, 'r')
68-
else:
69-
textFile = open(filename, 'r')
65+
textFile = open(filename, 'r', encoding=encoding)
7066
except IOError:
7167
import tkinter.messagebox as tkMessageBox
7268
tkMessageBox.showerror(title='File Load Error',

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,8 @@ Installation
20472047
Library
20482048
-------
20492049

2050+
- Issue #8203: Fix IDLE Credits dialog: view_file() uses its encoding argument.
2051+
20502052
- Issue #5311: bdist_msi can now build packages that do not depend on a
20512053
specific Python version.
20522054

0 commit comments

Comments
 (0)