mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Changed example plugin to work in Python 3 [ci skip]
This commit is contained in:
parent
6a8220cb3e
commit
8e7010d9ae
|
@ -52,7 +52,6 @@ true color.
|
|||
**SpamImagePlugin.py**::
|
||||
|
||||
from PIL import Image, ImageFile
|
||||
import string
|
||||
|
||||
class SpamImageFile(ImageFile.ImageFile):
|
||||
|
||||
|
@ -63,10 +62,10 @@ true color.
|
|||
|
||||
# check header
|
||||
header = self.fp.read(128)
|
||||
if header[:4] != "SPAM":
|
||||
raise SyntaxError, "not a SPAM file"
|
||||
if header[:4] != b"SPAM":
|
||||
raise SyntaxError("not a SPAM file")
|
||||
|
||||
header = string.split(header)
|
||||
header = header.split()
|
||||
|
||||
# size in pixels (width, height)
|
||||
self._size = int(header[1]), int(header[2])
|
||||
|
@ -80,7 +79,7 @@ true color.
|
|||
elif bits == 24:
|
||||
self.mode = "RGB"
|
||||
else:
|
||||
raise SyntaxError, "unknown number of bits"
|
||||
raise SyntaxError("unknown number of bits")
|
||||
|
||||
# data descriptor
|
||||
self.tile = [
|
||||
|
|
Loading…
Reference in New Issue
Block a user