Skip to content
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

Argument parser errors are printed without a trailing newline #713

Open
emanuele6 opened this issue Oct 26, 2023 · 1 comment
Open

Argument parser errors are printed without a trailing newline #713

emanuele6 opened this issue Oct 26, 2023 · 1 comment

Comments

@emanuele6
Copy link
Contributor

Command Line

$ autopep8
incorrect number of arguments$ autopep8
incorrect number of arguments$

Your Environment

  • Python version: Python 3.11.5
  • autopep8 version: autopep8 2.0.4 (pycodestyle: 2.11.0)
  • Platform: windows, linux, macOSX, and other OS...: archlinux

Errors are printed without a trailing newline

@emanuele6 emanuele6 changed the title Errors are printed without a trailing newline Argument parser errors are printed without a trailing newline Oct 26, 2023
@emanuele6
Copy link
Contributor Author

emanuele6 commented Oct 29, 2023

I bisected the problem; it was introduced with 24da506 that replaced all calls to parser.error(message) with calls to parser.exit(EXIT_CODE_ARGPARSE_ERROR, message).

Before the change, those argparse errors were displayed as:

$ ./autopep8.py
usage: autopep8 [-h] [--version] [-v] [-d] [-i] [--global-config filename]
                [--ignore-local-config] [-r] [-j n] [-p n] [-a]
                [--experimental] [--exclude globs] [--list-fixes]
                [--ignore errors] [--select errors] [--max-line-length n]
                [--line-range line line] [--hang-closing] [--exit-code]
                [files ...]
autopep8: error: incorrect number of arguments
$ 

Now, they are displayed as:

$ ./autopep8.py
incorrect number of arguments$ # no trailing newline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant