Skip to content

ClickException message goes to stdout instead of stderr with version 7.1 #1495

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

Closed
greschd opened this issue Mar 9, 2020 · 5 comments
Closed
Labels
Milestone

Comments

@greschd
Copy link

greschd commented Mar 9, 2020

Thanks a lot for click - absolutely fantastic project.

I've noticed the following change when upgrading to 7.1, and am not sure if it's intentional or not:

Expected Behavior

When raising click.ClickException, the corresponding Error: <message> goes to stderr using click version 7.0.

Minimal reproducing code:

import click

@click.command()
def run():
    raise click.ClickException('exception message')

if __name__ == '__main__':
    run()
python <filename>.py 1> stdout 2> stderr

Actual Behavior

With version 7.1, the Error: exception message ends up in stdout instead of stderr.

Environment

  • Python version: Python 3.7.5
  • Click version: 7.1
  • OS: Ubuntu 18.04 [through WSL1]
  • Shell: GNU bash, version 4.4.20

Additional comments

As mentioned above I'm not sure if this is an intended change, but I couldn't find any mention on the Changelog, and this part of the docs still referes to show being printed to stderr.

Happy to do some more digging if this happens only on my system.

@greschd
Copy link
Author

greschd commented Mar 9, 2020

I believe the cause for this is that file is passed to format instead of echo here: https://github.com/pallets/click/blob/master/src/click/exceptions.py#L42

@davidism
Copy link
Member

davidism commented Mar 9, 2020

Wow, that's my bad, misplaced a paren. Fix coming soon.

@davidism davidism added the bug label Mar 9, 2020
@davidism davidism added this to the 7.1.1 milestone Mar 9, 2020
@greschd
Copy link
Author

greschd commented Mar 9, 2020

No worries, and thanks again for the awesome project.

@davidism
Copy link
Member

davidism commented Mar 9, 2020

7.1.1 is on PyPI

@greschd
Copy link
Author

greschd commented Mar 9, 2020

Awesome, thanks for the quick turnaround.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants