unicode icon indicating copy to clipboard operation
unicode copied to clipboard

Currently broken.

Open ei14 opened this issue 1 year ago • 3 comments

Running, for instance unicode U+0020, does not produce any useful results:

Traceback (most recent call last):
  File "/usr/bin/unicode", line 1066, in <module>
    main()
    ~~~~^^
  File "/usr/bin/unicode", line 1063, in main
    print_characters(processed_args, options.maxcount, format_string, options.query_wikipedia, options.query_wiktionary)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/unicode", line 786, in print_characters
    formatted_output = format_string.format(**locals())
KeyError: 'yellow'

unicode version: 2.9-4. Python version: 3.13.1.

ei14 avatar Jan 18 '25 05:01 ei14

user@host ~ % unicode -C off A
Traceback (most recent call last):
  File "/Users/user/Library/Python/3.13/bin/unicode", line 1066, in <module>
    main()
    ~~~~^^
  File "/Users/user/Library/Python/3.13/bin/unicode", line 1063, in main
    print_characters(processed_args, options.maxcount, format_string, options.query_wikipedia, options.query_wiktionary)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/Library/Python/3.13/bin/unicode", line 727, in print_characters
    opt_lowercase = '\n{green}Lowercase:{default} {ord_lowercase:04X}'.format(**locals())
KeyError: 'green'
zsh: exit 1     unicode -C off A

It seems like -C USE_COLOUR, --colour=USE_COLOUR and --color=USE_COLOUR were completely ignored.

  • unicode 2.9
  • python3 3.13.3

I think this might be fixed by https://github.com/garabik/unicode/commit/fbe96d988b440969c95eba9a41d150f471cad90e. At least, I can run unicode successfully with uv from the master branch (commit 7df103e currently) with Python 3.13 (or 3.14):

$ uv tool run  --python 3.13 git+https://github.com/garabik/unicode -- z
U+007A LATIN SMALL LETTER Z
UTF-8: 7a UTF-16BE: 007a Decimal: &#122; Octal: \0172
z (Z)
Uppercase: 005A
Category: Ll (Letter, Lowercase); East Asian width: Na (narrow)
Bidi: L (Left-to-Right)

and install it with uv tool install git+https://github.com/garabik/unicode.

The latest tag v2.9 fails with 3.13:

$  uv tool run  --python 3.13 git+https://github.com/garabik/[email protected] -- z
Traceback (most recent call last):
  File "/Users/ilyagr/.cache/uv/archive-v0/FtDwFS96GeNu2IU4q58lr/bin/unicode", line 1068, in <module>
    main()
    ~~~~^^
  File "/Users/ilyagr/.cache/uv/archive-v0/FtDwFS96GeNu2IU4q58lr/bin/unicode", line 1065, in main
    print_characters(processed_args, options.maxcount, format_string, options.query_wikipedia, options.query_wiktionary)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ilyagr/.cache/uv/archive-v0/FtDwFS96GeNu2IU4q58lr/bin/unicode", line 725, in print_characters
    opt_uppercase = '\n{green}Uppercase:{default} {ord_uppercase:04X}'.format(**locals())
KeyError: 'green'

It'd be nice to get a release.

ilyagr avatar Jun 28 '25 20:06 ilyagr

According to https://github.com/garabik/unicode/blob/master/debian/changelog, there has been a release 3.2-1 with Python 3.13 support. (Update: And I tested it; it works fine with both 3.13 and 3.14 betas). It's just not tagged on GitHub, so it's hard to guess which commit to package for other distributions.

Update: I filed #27 to make this tagging issue a bit more noticeable.

ilyagr avatar Jun 28 '25 21:06 ilyagr