You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running code with Japanese comments in PygameZero mode
What steps did you take to trigger the issue?
For Japanese children, understanding source code in English is very difficult. Therefore, I teach them to write explanations of the source code in Japanese.
I chose PygameZero Mode.
I wrote the following code
# エイリアンを作成する
alien = Actor('alien')
I pressed the Play button.
What did you expect to happen?
UnicodeDecodeError occurred.
What actually happened?
pygame 2.1.2 (SDL 2.0.18, Python 3.8.12)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "C:\Users\umeno\AppData\Local\Programs\MUEDIT~1\Python\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\umeno\AppData\Local\Programs\MUEDIT~1\Python\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\umeno\AppData\Local\python\mu\mu_venv-38-20241126-182034\lib\site-packages\pgzero\__main__.py", line 3, in <module>
main()
File "C:\Users\umeno\AppData\Local\python\mu\mu_venv-38-20241126-182034\lib\site-packages\pgzero\runner.py", line 77, in main
src = f.read()
UnicodeDecodeError: 'cp932' codec can't decode byte 0x88 in position 24: illegal multibyte sequence
---------- FINISHED ----------
exit code: 1 status: 0
Operating System Version
Windows10
Mu Version
1.2.0
Other Info
It seems that Python is mistakenly recognizing the code as being written in cp932.
Therefore, if you write the following at the beginning of the source code, it will work correctly.
# coding: cp932
However, if the checking function is used on code with cp932 specified as the character encoding, MU-Editor crashes.
Traceback (most recent call last):
File "C:\Users\umeno\AppData\Local\Programs\Mu Editor\Python\lib\site-packages\mu\logic.py", line 1347, in check_code
flake = check_flake(filename, tab.text(), builtins)
File "C:\Users\umeno\AppData\Local\Programs\Mu Editor\Python\lib\site-packages\mu\logic.py", line 387, in check_flake
check(code, filename, reporter)
File "C:\Users\umeno\AppData\Local\Programs\Mu Editor\Python\lib\site-packages\pyflakes\api.py", line 47, in check
file_tokens = checker.make_tokens(codeString)
File "C:\Users\umeno\AppData\Local\Programs\Mu Editor\Python\lib\site-packages\pyflakes\checker.py", line 750, in make_tokens
return tuple(tokenize.tokenize(lambda: next(lines, b'')))
File "C:\Users\umeno\AppData\Local\Programs\Mu Editor\Python\lib\tokenize.py", line 455, in _tokenize
line = line.decode(encoding)
UnicodeDecodeError: 'cp932' codec can't decode byte 0x88 in position 24: illegal multibyte sequence
I hope that Japanese comments can be written in PygameZero, and that the checking function works correctly.
Editor Log
Sorry , I cannot paste the log file because it contains personal information.
The text was updated successfully, but these errors were encountered:
What were you trying to do?
Running code with Japanese comments in PygameZero mode
What steps did you take to trigger the issue?
For Japanese children, understanding source code in English is very difficult. Therefore, I teach them to write explanations of the source code in Japanese.
I chose PygameZero Mode.
I wrote the following code
What did you expect to happen?
UnicodeDecodeError occurred.
What actually happened?
Operating System Version
Windows10
Mu Version
1.2.0
Other Info
It seems that Python is mistakenly recognizing the code as being written in cp932.
Therefore, if you write the following at the beginning of the source code, it will work correctly.
However, if the checking function is used on code with cp932 specified as the character encoding, MU-Editor crashes.
I hope that Japanese comments can be written in PygameZero, and that the checking function works correctly.
Editor Log
Sorry , I cannot paste the log file because it contains personal information.
The text was updated successfully, but these errors were encountered: