-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
UTF-8 path-chars Encoding Issue during poetry install #8550
Comments
probably wants an explicit |
@dimbleby Hi. Thanks for addressing it. I've only checked |
I don't understand your concern - what do you think goes wrong if adding the parameter to subprocess calls? prefer explicit parameters, clearer what they're for |
also I don't think that your suggestion addresses the issue reported here. AIUI the question isn't whether the python subprocess is expecting or producing utf-8, the question is how the input to that python subprocess - |
@dimbleby I completely misunderstood. OK, I see that the problem reported in this ticket is about the encoding which is handled not by the child python but by the parent one. Thanks for explaining it and I apologize for troubling you. Nevertheless, for your information, I'll put another potential problem here that might appear after you set encoding of subprocess. Please see the following script: # encoding_test.py
import os
import subprocess
import sys
from typing import Optional
env = dict(os.environ)
counter = 1
def run(enable_i_option: bool, encoding: Optional[str], input: str, env: dict):
global counter
print(counter)
counter += 1
cmd = [sys.executable] + (["-I"] if enable_i_option else []) + ['-W', 'ignore', '-']
try:
output = subprocess.run(
cmd,
stdout=subprocess.PIPE,
input=input,
check=True,
env=env,
text=True,
encoding=encoding,
).stdout
print(output)
except Exception:
print(sys.exc_info()[1])
# ASCII input
run(True, None, 'print("OK")', env)
# Your solution here for non-ascii input
run(True, "utf-8", 'print("ÖK")', env)
# My suggestion
run(False, "utf-8", 'print("ÖK")', env | {"PYTHONIOENCODING": "utf-8"}) In my Windows (Japanese) environment, the output of
On the other hand, in Ubuntu (WSL), the output causes no problem.
Your environment will produce the latter, I guess, while in some environment, the child python doesn't assume utf-8 unless forced. I haven't checked if it actually produces an error after fixing poetry as you suggest. Sorry if I still misunderstand all of that. |
I'm not a windows user and don't have non-ascii characters in my path so I'm not well placed to do anything with this issue and also don't much care about it anyway. I could believe that it might be necessary both to encode strings as utf8 from the parent python, and also to ask the child python to do the same. Or it might not, I'm really not sure. Recommend that if you - or any other reader - are hitting problems here: try either or both fixes, and submit a merge request! |
I will take a look at this when i find time.
I would also not prefer to have 'ä' in any path but as i use a company
domain for windows license, the user root path gets auto-named when
installing windows through the domain.
For now I just downgraded to poetry 1.5.1, which does not produce this
issue and consulted my domain admin to replace the special characters in
the name-reference of my windows license^^
Greetings
…On Fri, Oct 20, 2023 at 12:46 PM David Hotham ***@***.***> wrote:
I'm not a windows user and don't have non-ascii characters in my path so
I'm not well placed to do anything with this issue and also don't much care
about it anyway.
I could believe that it might be necessary *both* to encode strings as
utf8 from the parent python, and also to ask the child python to do the
same. Or it might not, I'm really not sure.
Recommend that if you - or any other reader - are hitting problems here:
try either or both fixes, and submit a merge request!
—
Reply to this email directly, view it on GitHub
<#8550 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A7K7SL4VWW2RXXV64QXSPATYAJI7XAVCNFSM6AAAAAA6FCXOXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZSGUYTENRZGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
FYI: I realized that I didn't need to drop |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
-vvv
option) and have included the output below.Issue
Hello,
there seems to be an Issue with UTF-8 Encoding during dynamic installation process of packages.
My Path contains a special character (ä), seems like that caused the problem during reading from
stdin
(no encoding declared).I know its bad practice to have that in path but i use a company domain and user-path is auto-set by windows during startup :<.
(I was able to bypass this issue by downgrading to poetry 1.5.1)
Trace back:
The text was updated successfully, but these errors were encountered: