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
Poe 0.16.5 doesn't work on some non-utf-8 Windows environment #111
Comments
Hi @privet-kitty, Thanks for reporting this issue and suggesting a solution. I plan to include your fix in an upcoming release. I guess that environment variable should also be set/respected when running tasks that capture output in the executor like this. Would you foresee any downside with that? |
@privet-kitty This feature is now available as part of v0.17.0. |
@nat-n Thank you for merging!
Actually I don't quite understand the necessity that you care |
@privet-kitty yes, users can control it (still), though my intention is that this way they're less likely to have to think about it. Thanks for the feedback. :) |
Hi. Thank you for maintaining this awesome task-runner. I ran into a problem on Windows with Japanese language environment. The minimal reproducible example would be as follows:
pyproject.toml
under a directory whose path contains multi-byte characters (e.g.C:\Users\username\テスト
).poetry config virtualenvs.in-project true --local
andpoetry install
.poe python
and see it fail.PYTHONIOENCODING="cp932"
in advance would be a way, for example.The error would be as follows.
The cause is,
bytes.decode()
assumesutf-8
when no encoding is given, but whatpoetry env info -p
outputs is not necessarily inutf-8
. In my environment, the correct encoding iscp932
when the python output is piped. It appears to be a traditional problem onsys.stdout.encoding
, which python "wisely" decides depending on the execution environment and the output stream.1I confirmed that the example above failed on 0.16.5 but not 0.16.4. I guess it's just because the recent changes (15edd33) have made it so that
_get_poetry_virtualenv
is always called. It should be an inapparent problem in older versions too.As for the solution, it would be a way, setting
PYTHONIOENCODING
toutf-8
before invokingpoetry env info -p
(67707aa). I'm not confident about how decent this workaround is, but anyway that resolved my issue.Footnotes
For your information, the related stackoverflow posts would be Why do the sys.stdout.encoding differ when output is piped (in Python2.x)? or Setting the correct encoding when piping stdout in Python ↩
The text was updated successfully, but these errors were encountered: