From caf95de62a85d992d2120a19566b6c6380b11e3f Mon Sep 17 00:00:00 2001 From: MJD Date: Thu, 21 Sep 2023 10:59:54 -0600 Subject: [PATCH] Update quickstart - close file via context manager. (#3867) --- docs/source/guide/quickstart.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/guide/quickstart.rst b/docs/source/guide/quickstart.rst index 18313b3d78..6870a0203c 100644 --- a/docs/source/guide/quickstart.rst +++ b/docs/source/guide/quickstart.rst @@ -144,8 +144,8 @@ You can also upload and download binary data. For example, the following uploads assuming that the bucket ``my-bucket`` already exists:: # Upload a new file - data = open('test.jpg', 'rb') - s3.Bucket('my-bucket').put_object(Key='test.jpg', Body=data) + with open('test.jpg', 'rb') as data: + s3.Bucket('my-bucket').put_object(Key='test.jpg', Body=data) :ref:`guide_resources` and :ref:`guide_collections` are covered in more detail in the following sections.