Skip to content

Commit 845eeab

Browse files
authored
Merge pull request #422 from vstoykov/fix/documentation-for-python3
Improve docs for Python 3 - files should be opened as binary
2 parents c3dbb1e + 755bd34 commit 845eeab

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ on, or what should be done with the result; that's up to you:
144144

145145
.. code-block:: python
146146
147-
source_file = open('/path/to/myimage.jpg')
147+
source_file = open('/path/to/myimage.jpg', 'rb')
148148
image_generator = Thumbnail(source=source_file)
149149
result = image_generator.generate()
150150
@@ -159,7 +159,7 @@ example, if you wanted to save it to disk:
159159

160160
.. code-block:: python
161161
162-
dest = open('/path/to/dest.jpg', 'w')
162+
dest = open('/path/to/dest.jpg', 'wb')
163163
dest.write(result.read())
164164
dest.close()
165165

docs/advanced_usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ A simple example of a custom source group class is as follows:
163163
def files(self):
164164
os.chdir(self.dir)
165165
for name in glob.glob('*.jpg'):
166-
yield open(name)
166+
yield open(name, 'rb')
167167
168168
Instances of this class could then be registered with one or more spec id:
169169

0 commit comments

Comments
 (0)