Seongwoo Min
Seongwoo Min

Reputation: 11

python PIL image.open() error

hello i'm using PIL to open images but there are such errors like this; Traceback (most recent call last):

  File "/Users/minsw0810gmail.com/Desktop/GUIAccidentAlarm.py", line 
142, in <module>
   filename1 = Image.open('횡단보도상_100x100.jpg', "rb")
  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages/PIL/Image.py", line 2462, in open
    raise ValueError("bad mode %r" % mode)
ValueError: bad mode 'rb'
[Finished in 0.8s with exit code 1]
[shell_cmd: python -u 
"/Users/minsw0810gmail.com/Desktop/GUIAccidentAlarm.py"]
[dir: /Users/minsw0810gmail.com/Desktop]
[path: /usr/bin:/bin:/usr/sbin:/sbin]

*횡단보도상_100x100.jpg is korean and my code is

filename1 = Image.open('횡단보도상_100x100.jpg')

Upvotes: 0

Views: 16074

Answers (1)

fl4w
fl4w

Reputation: 31

Image.open() only supports "r" as mode parameters and throws an exception for everything else.

Here is what the doc says about this parameter:

mode – The mode. If given, this argument must be “r”.

For more information here is the link:

http://pillow.readthedocs.io/en/3.4.x/reference/Image.html#PIL.Image.open

I hope this can help you.

Upvotes: 3

Related Questions