Skip to content

Bytes filenames should be accepted with Python 3 #258

@Arfrever

Description

@Arfrever

Bytes filenames should be accepted with Python 3. They are accepted with Python 2. An application might want to use bytes filenames to avoid problems with undecodable characters.

$ python2.7 -c 'import PIL.Image; PIL.Image.open(b"file.png")'
$ python3.3 -c 'import PIL.Image; PIL.Image.open(b"file.png")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python3.3/site-packages/PIL/Image.py", line 1993, in open
    prefix = fp.read(16)
AttributeError: 'bytes' object has no attribute 'read'

Also there is NameError in line 491 of PIL/JpegImagePlugin.py with Python 3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugAny unexpected behavior, until confirmed feature.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions