From b8d255071ead897cf68120cd2fae7c91326ca2cc Mon Sep 17 00:00:00 2001 From: Dean Silfen Date: Tue, 15 Jul 2014 12:43:52 -0400 Subject: [PATCH] Edited setup.py in reuseable apps tutorial to use a context manager for open(). --- docs/intro/reusable-apps.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/intro/reusable-apps.txt b/docs/intro/reusable-apps.txt index 7f1d984d1f..a32614285a 100644 --- a/docs/intro/reusable-apps.txt +++ b/docs/intro/reusable-apps.txt @@ -192,7 +192,8 @@ this. For a small app like polls, this process isn't too difficult. import os from setuptools import setup - README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() + with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: + README = readme.read() # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))