question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Console script in windows can't take unicode arguments[BUG]

See original GitHub issue

setuptools version

60.4.2

Python version

3.9

OS

Windows10

Additional environment information

No response

Description

setup.py consolescripts can’t take unicode command line arguments on windows, while the respective .py file can.

e.g. all_dl.py

console_script in setup.py: all-dl=all_dl:main

def main(): print(sys.argv[1])

if name == “main”: main()

python all_dl.py एक परिचय

ouputs एक परिचय.

but

all-dl एक परिचय.

outputs ???

Expected behavior

The latter output should be similar to former

How to Reproduce

  1. Write the small py file
  2. make a console script for that file
  3. pass unicode arg to py file and the exe file
  4. See the difference

Output


1st case - एक परिचय. 2nd case - ???

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
uranusjrcommented, Apr 17, 2022

To correctly take input and print output of a given character range, you must use a console capable of receiving and emitting an encoding covering the character range, and have your application use that encoding. There are modern tools on Windows that can handle this correctly, but your environment may not.

The bottom line is, this is not a bug in pip (or setuptools, or distlib, or Python), but just how old Windows things do not handle non-ASCII well. You may have better luck finding help on a general Python Q&A forum, or a local user group (where people tend to have more experience dealing with the local language).

0reactions
abravalhericommented, Apr 17, 2022

Thank you very much @uranusjr for clarifying the problem.

I think I will go ahead and close this issue, since there isn’t a direct action point.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use unicode characters in Windows command line?
The most secure solution is this one: Go to your Registry key HKEY_CURRENT_USER\Software\Microsoft\Command Processor and add String value Autorun = chcp 65001 ....
Read more >
Issue 1602: windows console doesn't print or input Unicode
msg58487 ‑ (view) Author: Mark Summerfield (mark) * Date: 2007‑12‑12 09:56 msg58621 ‑ (view) Author: Mark Summerfield (mark) * Date: 2007‑12‑14 11:31 msg58651 ‑ (view)...
Read more >
Unicode and UTF-8 Output Text Buffer - Windows Command ...
In this post, we'll discuss the improvements we've been making to the Windows Console's internal text buffer, enabling it to better store and...
Read more >
78584 – [Win32] Unicode character suppport for the command ...
On Windows, The user can not specify any Unicode characters not existing in OS native charset in the command line arguments, and args...
Read more >
Accepting Command Line Arguments - Learn Rust
The args Function and Invalid Unicode. Note that std::env::args will panic if any argument contains invalid Unicode. If your program needs to accept...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found