Closed LussacZheng closed 3 years ago
There are several open()
in tests/conftest.py
. I am not sure if I should make the same changes to them.
@LussacZheng thanks for investigating (and explaining) this issue. I've learned something.
It wouldn't hurt to make the open calls in conftest.py explicit as well, although it shouldn't really matter since these will only refer to files within the project.
If you rebase onto master then the CI tests should work again.
Issue
If there are Chinese characters in
pyproject.toml
, poe will fail to run tasks.I am not sure if other special characters might cause the same problem.
Platform
pyproject.toml
The
pyproject.toml
was saved withUTF-8
encoding, andLF
line-endings.When I try to run
poetry run poe t1
, the error shows up as:It was supposed to print
你好
("Hello" in Chinese) instead of浣犲ソ
(a random and meaningless word), which is caused by a typical encode/decode issue.Reason
According to Python Standard Library documentation about the built-in function
open()
:The default encoding seems to be "gbk" in a Windows 10 Simplified Chinese operating system.
Once turning my
pyproject.toml
intoGBK
encoding, the poe task works.Test
There is another case which can also support this reason (actually this is why I found this issue):
Change the 5th line of
pyproject.toml
fromauthors = ["Author"]
toauthors = ["作者"]
(
作者
means "author" in Chinese):Then Poe will crash when running tasks:
Inject the debug code into
poethepoet/config.py
:https://github.com/nat-n/poethepoet/blob/996c75b9505e6923873a4ede976bc36863f32398/poethepoet/config.py#L160-L167
Please let me know if there are any mistakes above.
References