-
Notifications
You must be signed in to change notification settings - Fork 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
On Windows, console script wrapper (exe) created by pip cannot process non-ANSI (Unicode) arguments #11800
Comments
The reproduction works for me without error. I suspect this is because I'm using Windows Terminal and Powershell, which have "better" UTF-8 handling than cmd. Having said that, it also works for me in cmd. So this is somehow related to your console environment, which isn't to say it's not a problem, just that (1) it will probably improve over time as environments get better UTF-8 support and (2) it's hard for maintainers to fix as they can't reproduce the issue. In this case, I suspect that the issue is with the script wrappers pip uses, which come from the |
7.3.2 |
I sympathise, but this isn't a pip issue. As I said, you may be able to produce a test case using just distlib and report that to the distlib project, but that's about all I can suggest. I'm going to close this, as I don't think it's something that needs fixing in pip (if it gets fixed in distlib, we'll pick up any fix when we vendor the new version of distlib). |
No worries, I will try to test it directly with For what it's worth, I just removed [project]
name = "echotest"
version = "1.0"
dependencies = [
]
[project.scripts]
echotest = "echotest.__main__:main" After re-installing, the new If you can share any insight about why they build the wrapper differently, it would be very helpful. But either way, thanks for help. |
Huh, that's weird. Oh, wait. If you are getting Ah, you get the message "DEPRECATION: echotest is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at #8559" in your output. I don't, because I don't have the necessary condition to trigger it (setuptools installed but wheel not installed). Having said that, I still don't get the issue - but setuptools does use a different wrapper. Maybe you have an old version of setuptools? What does |
Name: setuptools |
Hmm, I tried back to 54.2.0, and didn't reproduce the issue. I suspect it's a bug in the wrappers setuptools uses - but they may not be willing to fix it as we're moving away from that installation method. I'd say the best fix is simply to not use the legacy install method - either add a |
I was misleaded by pypa/setuptools#3268 (comment) & #11040 and thought it was pip who builds the launcher. After you pointed it back to setuptools, I quickly find pypa/setuptools#595 So apparently it's a known issue (due to using outdated C API in Windows), just that it likely won't be fixed since distlib would be the future, as you also suggested. I call this case closed. Again, thanks for your help! |
Glad to help - it was an interesting question to investigate! |
Description
When install a module using pip that has a console script, the created XXX.exe wrapper cannot process non-ASNI arguments properly (characters become ???).
This issue has been reported before (pypa/setuptools#3268, #11040), but was closed due to "it's your console's issue".
Windows CMD does have its issues, but it can handle non-ANSI arguments fine. If I just feed them in directly into python, or using the companioned
echotest-script.py
, everything works.See STR below for demonstration for detail.
Expected behavior
The wrapper should be able to handle non-ANSI characters.
pip version
23.0
Python version
3.11
OS
Win10 22H2
How to Reproduce
Here is a simple example.
Create a folder with two files:
setup.py
:echotest\__main__.py
:Install this package, using
pip install .
Now, change CWD to another folder (to avoid name confliction), and try the following (assuming
/Scripts
is already in %path%):python -m echotest 中文 python "C:\Users\{yourusername}\AppData\Local\Programs\Python\Python311\Scripts\echotest-script.py" 中文 echotest 中文
Output
Code of Conduct
The text was updated successfully, but these errors were encountered: