Skip to content

Commit

Permalink
Update quickstart - close file via context manager. (#3867)
Browse files Browse the repository at this point in the history
  • Loading branch information
mijdavis2 authored Sep 21, 2023
1 parent 181d253 commit caf95de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/source/guide/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit caf95de

Please sign in to comment.