Skip to content

ImageCms.getOpenProfile does not support Unicode path #4897

@fireattack

Description

@fireattack

What did you do?

I tried to load an ICC file from a non-Latin path.

What did you expect to happen?

It should load the profile.

What actually happened?

It throws

F:\sync\code\python\_gists>_test.py
Traceback (most recent call last):
  File "C:\Program Files\Python3\lib\site-packages\PIL\ImageCms.py", line 395, in getOpenProfile
    return ImageCmsProfile(profileFilename)
  File "C:\Program Files\Python3\lib\site-packages\PIL\ImageCms.py", line 162, in __init__
    self._set(core.profile_open(profile), profile)
OSError: cannot open profile file

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "F:\sync\code\python\_gists\_test.py", line 3, in <module>
    lsrgb_profile = ImageCms.getOpenProfile('D:\\新\\sRGB.icc')
  File "C:\Program Files\Python3\lib\site-packages\PIL\ImageCms.py", line 397, in getOpenProfile
    raise PyCMSError(v) from v
PIL.ImageCms.PyCMSError: cannot open profile file

What are your OS, Python and Pillow versions?

  • OS: Win7x64
  • Python: 3.8.5 x64
  • Pillow: 7.2.0
from PIL import Image, ImageCms

lsrgb_profile = ImageCms.getOpenProfile('D:\\\\sRGB.icc')

Similar and fixed issue: #3145

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions