summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2013-05-13 20:07:44 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2013-05-13 20:07:44 (GMT)
commitbf4cba7e8b2fd95351e28378c7716a62911d13e5 (patch)
treea6570d3bb6d666d30456ae1ef97b8a95d416254c /Lib/idlelib
parent01180d4679410d744aacfd3c79e6e4bce9a38e9a (diff)
downloadcpython-bf4cba7e8b2fd95351e28378c7716a62911d13e5.zip
cpython-bf4cba7e8b2fd95351e28378c7716a62911d13e5.tar.gz
cpython-bf4cba7e8b2fd95351e28378c7716a62911d13e5.tar.bz2
Silence unclosed open file ResourceWarning.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r--Lib/idlelib/textView.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/idlelib/textView.py b/Lib/idlelib/textView.py
index 845d754..b5fd7cd 100644
--- a/Lib/idlelib/textView.py
+++ b/Lib/idlelib/textView.py
@@ -80,7 +80,8 @@ if __name__ == '__main__':
root=Tk()
root.title('textView test')
filename = './textView.py'
- text = open(filename, 'r').read()
+ with open(filename, 'r') as f:
+ text = f.read()
btn1 = Button(root, text='view_text',
command=lambda:view_text(root, 'view_text', text))
btn1.pack(side=LEFT)