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

[tools/kconfiglib] UnicodeDecodeError: 'cp932' codec can't decode. (IDFGH-2943) #4977

Closed
lovyan03 opened this issue Mar 23, 2020 · 5 comments
Assignees

Comments

@lovyan03
Copy link
Contributor

The default code page for Japanese python is cp932, and if you don't specify the encoding when loading the file, you may get an error.

image

This can be solved by adding an encoding specification when the file is opened.

--- /esp-idf/tools/kconfig_new/kconfiglib.py
+++ /esp-idf/tools/kconfig_new/kconfiglib.py
@@ -1125,7 +1125,7 @@
         was set when the configuration was loaded.
         """
         try:
-            return open(filename)
+            return open(filename, encoding="utf-8")
         except IOError as e:
             if not os.path.isabs(filename) and self.srctree is not None:
                 filename = os.path.join(self.srctree, filename)
@github-actions github-actions bot changed the title The idf.py of ESP-IDF setup2.3 doesn't work because it raises UnicodeDecodeError: 'cp932' codec can't decode. The idf.py of ESP-IDF setup2.3 doesn't work because it raises UnicodeDecodeError: 'cp932' codec can't decode. (IDFGH-2943) Mar 23, 2020
@dobairoland
Copy link
Collaborator

Hi @lovyan03. Thank you for reporting this issue.

Please give us your IDF version (git describe --tags) and your Python version (python --version).

I'm guessing that your IDF version is v4.0 or older because this seems to been fixed in the upstream kconfiglib library which is shipped with IDF v4.1 and newer.

Would it be possible that you check the latest IDF master branch to verify that you have no issue there?

@dobairoland dobairoland changed the title The idf.py of ESP-IDF setup2.3 doesn't work because it raises UnicodeDecodeError: 'cp932' codec can't decode. (IDFGH-2943) [tools/kconfiglib] UnicodeDecodeError: 'cp932' codec can't decode. (IDFGH-2943) Mar 23, 2020
@lovyan03
Copy link
Contributor Author

Hello !
thank you for reply.

I used the installer esp-idf-tools-setup-2.3.exe, and in Download ESP-IDF I chose v4.0.

git describe --tags
v4.0

python --version
Python 3.7.3

I tried to synchronize ESP-IDF, but I didn't know how to use it and couldn't build it.

@dobairoland
Copy link
Collaborator

Thank you. Please use your workaround until we fix this.

@lovyan03
Copy link
Contributor Author

Thank you !
I used the installer again and tried to select develop master when choosing ESP-IDF.
You're right, the problem has been fixed and I can now build it.

@dobairoland
Copy link
Collaborator

That is great!

I keep this issue open until this is fixed for IDF <=v4.0.

@dobairoland dobairoland reopened this Mar 23, 2020
@dobairoland dobairoland self-assigned this Mar 23, 2020
espressif-bot pushed a commit that referenced this issue Mar 31, 2020
This fix is for IDF v4.0 and earlier versions. The upstream kconfiglib
included since IDF v4.1 doesn't have this issue.

Closes #4977
espressif-bot pushed a commit that referenced this issue Apr 3, 2020
This fix is for IDF v4.0 and earlier versions. The upstream kconfiglib
included since IDF v4.1 doesn't have this issue.

Closes #4977
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

2 participants