Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The model path exists in Chinese, depthai_demo.py cannot run error #294

Closed
hello-word-yang opened this issue Dec 6, 2021 · 7 comments
Closed

Comments

@hello-word-yang
Copy link

There is Chinese in my model path, and an error is reported when loading the file model as shown in the figure below.

E64FE236-71AD-4eb7-9B66-80D8FB07A910

We found that it was because the std::ifstream method failed to open a file with a Chinese path.

std::ifstream stream(path, std::ios::in | std::ios::binary);

Can you help us solve this problem? thanks.

@Luxonis-Brandon
Copy link
Contributor

Asking team. Not immediately sure.

@themarpe
Copy link
Collaborator

themarpe commented Dec 7, 2021

Hi @hello-word-yang
Seems like its a Windows specific issue. Checking on how to properly handle this for Windows platform...

@themarpe
Copy link
Collaborator

themarpe commented Dec 7, 2021

@hello-word-yang I think what might immediately remedy the issue is setting UTF-8 support in Locale under Windows settings.

image

(Source: https://pete.akeo.ie/2019/11/powershell-script-to-convert-utf-8.html)

Otherwise it seems like we have to handle the path as UTF-16 and use wide strings in Windows case...
Will look into adding clean support for that as well

@themarpe
Copy link
Collaborator

themarpe commented Dec 7, 2021

Note: The above UTF-8 support is a system wide change and may affect other software running on the computer. I advise to continue with precaution and rollback if undesired side effects show up

@hello-word-yang
Copy link
Author

hi, @themarpe

Thanks for your reply, I will test the method you mentioned as soon as possible.

@hello-word-yang
Copy link
Author

hi, @themarpe

After my test, after modifying the encoding format of the system to utf-8, depthai-demo.py can run normally when the model path contains Chinese path.

Thank you for the solution.

But I think it is better to solve this problem from the code level, because it is impossible for all users to modify the system.

@themarpe
Copy link
Collaborator

themarpe commented Dec 8, 2021

But I think it is better to solve this problem from the code level, because it is impossible for all users to modify the system.

I agree - I wish Windows will push more into UTF-8 direction, so this won't be a platform dependent thing anymore.
Will see how I'll be with time the next couple of weeks. Thanks for testing it out:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants