vision: torchvision.io.read_image : [Errno 42] Illegal byte sequence
The image cannot be loaded if the path contains multibyte strings.
To Reproduce
import torchvision
file_path = "D:\\日本語(Japanese)\\Sample.png"
# It's work.
f = open(file_path, 'rb')
f.close()
# It's not work.
tensor_image = torchvision.io.read_image(file_path)
--------------------------------------------------------
data = torch.ops.image.read_file(path)
RuntimeError: [Errno 42] Illegal byte sequence: 'D:\日本語(Japanese)\Sample.png'
Environment
PyTorch / torchvision Version (e.g., 1.0 / 0.4.0): 1.7.0/0.8.1 OS (e.g., Linux): Windows 10 How you installed PyTorch / torchvision (conda, pip, source): pip Build command you used (if compiling from source): Python version: 3.7.9 CUDA/cuDNN version: 10.1 GPU models and configuration: Geforce GTX 1060 Any other relevant information: None
cc @peterjc123 @nbcsm @guyang3532 @maxluk @gunandrose4u @smartcat2010 @mszhanyi
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (12 by maintainers)
@fmassa , @peterjc123, @andfoy, Thank you for your prompt response! I’m looking forward to the next release.