httpie / cli

🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
https://httpie.io
BSD 3-Clause "New" or "Revised" License
33.56k stars 3.67k forks source link

Help option crash #1411

Open troplolBE opened 2 years ago

troplolBE commented 2 years ago

Checklist


Minimal reproduction code and steps

  1. install httpie latest version on debian
  2. run the command http --help

Current result

Traceback (most recent call last):
  File "http_cli.py", line 5, in <module>
  File "httpie/__main__.py", line 9, in main
  File "httpie/core.py", line 162, in main
  File "httpie/core.py", line 77, in raw_main
  File "httpie/cli/argparser.py", line 159, in parse_args
  File "argparse.py", line 1869, in parse_known_args
  File "argparse.py", line 2078, in _parse_known_args
  File "argparse.py", line 2018, in consume_optional
  File "argparse.py", line 1946, in take_action
  File "argparse.py", line 1110, in __call__
  File "argparse.py", line 2566, in print_help
  File "httpie/cli/argparser.py", line 125, in _print_message
  File "argparse.py", line 2572, in _print_message
UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 10678: ordinal not in range(128)
[19189] Failed to execute script 'http_cli' due to unhandled exception!

Expected result

The help menu from httpie.


Debug output

Please re-run the command with --debug, then copy the entire command & output and paste both below:

$ http --debug --help
HTTPie 3.2.1
Requests 2.27.1
Pygments 2.12.0
Python 3.9.12 (main, Apr 16 2022, 19:31:36)
[GCC 7.5.0]
/usr/bin/http
Linux 4.19.0-16-cloud-amd64

<Environment {'apply_warnings_filter': <function Environment.apply_warnings_filter at 0x7f1a16b09a60>,
 'args': Namespace(),
 'as_silent': <function Environment.as_silent at 0x7f1a16b09940>,
 'colors': 256,
 'config': {'__meta__': {'about': 'HTTPie configuration file',
                         'help': 'https://httpie.org/docs#config',
                         'httpie': '0.9.8'},
            'default_options': []},
 'config_dir': PosixPath('/home/debian/.httpie'),
 'devnull': <property object at 0x7f1a16b0c1d0>,
 'is_windows': False,
 'log_error': <function Environment.log_error at 0x7f1a16b099d0>,
 'program_name': 'http',
 'quiet': 0,
 'rich_console': <functools.cached_property object at 0x7f1a16b02a00>,
 'rich_error_console': <functools.cached_property object at 0x7f1a16af5400>,
 'show_displays': True,
 'stderr': <_io.TextIOWrapper name='<stderr>' mode='w' encoding='ascii'>,
 'stderr_isatty': True,
 'stdin': <_io.TextIOWrapper name='<stdin>' mode='r' encoding='ascii'>,
 'stdin_encoding': 'ascii',
 'stdin_isatty': True,
 'stdout': <_io.TextIOWrapper name='<stdout>' mode='w' encoding='ascii'>,
 'stdout_encoding': 'ascii',
 'stdout_isatty': True}>

<PluginManager {'adapters': [],
 'auth': [<class 'httpie.plugins.builtin.BasicAuthPlugin'>,
          <class 'httpie.plugins.builtin.DigestAuthPlugin'>,
          <class 'httpie.plugins.builtin.BearerAuthPlugin'>],
 'converters': [],
 'formatters': [<class 'httpie.output.formatters.headers.HeadersFormatter'>,
                <class 'httpie.output.formatters.json.JSONFormatter'>,
                <class 'httpie.output.formatters.xml.XMLFormatter'>,
                <class 'httpie.output.formatters.colors.ColorFormatter'>]}>
Traceback (most recent call last):
  File "http_cli.py", line 5, in <module>
  File "httpie/__main__.py", line 9, in main
  File "httpie/core.py", line 162, in main
  File "httpie/core.py", line 77, in raw_main
  File "httpie/cli/argparser.py", line 159, in parse_args
  File "argparse.py", line 1869, in parse_known_args
  File "argparse.py", line 2078, in _parse_known_args
  File "argparse.py", line 2018, in consume_optional
  File "argparse.py", line 1946, in take_action
  File "argparse.py", line 1110, in __call__
  File "argparse.py", line 2566, in print_help
  File "httpie/cli/argparser.py", line 125, in _print_message
  File "argparse.py", line 2572, in _print_message
UnicodeEncodeError: 'ascii' codec can't encode character '\u2019' in position 10678: ordinal not in range(128)
[19180] Failed to execute script 'http_cli' due to unhandled exception!

Additional information, screenshots, or code examples

I am on a cloud linux vps with debian 10. I used the pip version before but I uninstalled it to be sure.