-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
getCacheDirectoryForDownloads throws exception when encountering unicode paths #21960
Copy link
Copy link
Open
Labels
Description
System information (version)
- OpenCV => 4.2
- Operating System / Platform => Windows 11
- Compiler => Visual Studio 2019
Detailed description
getCacheDirectoryForDownloads uses GetTempPathA on Windows.
It uses the environment variable TMP.
Default: C:\Users\username\AppData\Local\Temp
getCacheDirectoryForDownloads throws an exception when the username contains unicode characters.
E.g: C:\Users\流星暴雨\AppData\Local\Temp
Steps to reproduce
# -*- coding: utf-8 -*-
import tempfile
import cv2
os.environ["TMP"] = tempfile.mkdtemp("测试")
print(cv2.utils.fs.getCacheDirectoryForDownloads())PS F:\opencv_test> python .\1.py
Traceback (most recent call last):
File "F:\opencv_test\1.py", line 10, in <module>
print(cv2.utils.fs.getCacheDirectoryForDownloads())
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc1 in position 9: invalid start byte
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues,
forum.opencv.org, Stack Overflow, etc and have not found any solution - I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files: videos, images, onnx, etc
Reactions are currently unavailable