This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: python --version should send output to STDOUT
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Matthew.Byrne, Michael Dickens, Ramchandra Apte, Stefan Sauer, berker.peksag, christian.heimes, jaalto, python-dev, serhiy.storchaka
Priority: normal Keywords: easy, patch

Created on 2013-07-01 11:01 by jaalto, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue18338.diff berker.peksag, 2013-07-03 09:46 review
issue18338.diff Matthew.Byrne, 2013-07-08 01:37 Patch for issue 18338 review
issue18338.diff Michael Dickens, 2013-07-09 23:29 review
Messages (13)
msg192119 - (view) Author: Jari Aalto (jaalto) Date: 2013-07-01 11:01
C.f. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=603851

When user is calling program with options, it is not an error
condition to run:

	python --version

The output is now sent to stderr. Please change to send to stdout as
in other *nix utilities, in order to collect in shell scrips:

   version=$(python --version)
msg192122 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-07-01 11:22
Your proposal is reasonable. I'm flagging it for Python 3.4+ as it's a backward incompatible modification.
msg192198 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2013-07-02 14:24
> Your proposal is reasonable. I'm flagging it for Python 3.4+ as it's a backward incompatible modification.

Agree.
msg192225 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2013-07-03 09:46
Here is a patch with an updated test.

The -v flag also sends the output to stderr. Should that be fixed too? See Modules/main.c:678 and Lib/test/test_cmd_line.py:l47
msg192228 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-07-03 10:36
LGTM.
msg192269 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2013-07-04 04:29
On 3 July 2013 15:16, Berker Peksag <report@bugs.python.org> wrote:

>
> Berker Peksag added the comment:
>
> Here is a patch with an updated test.
>
> The -v flag also sends the output to stderr. Should that be fixed too? See
> Modules/main.c:678 and Lib/test/test_cmd_line.py:l47
>
> ----------
> keywords: +patch
> nosy: +berker.peksag
> stage: needs patch -> patch review
> Added file: http://bugs.python.org/file30756/issue18338.diff
>
> No, -v is for debugging purposes and should go to stderr IMO.
msg192270 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2013-07-04 04:30
No, I think that

On 3 July 2013 16:06, Serhiy Storchaka <report@bugs.python.org> wrote:

>
> Serhiy Storchaka added the comment:
>
> LGTM.
>
> ----------
> nosy: +serhiy.storchaka
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue18338>
> _______________________________________
>
msg192605 - (view) Author: Matthew Byrne (Matthew.Byrne) Date: 2013-07-08 01:37
Simply replced printout from stderr to stdout.
msg192784 - (view) Author: Michael Dickens (Michael Dickens) Date: 2013-07-09 23:29
Patch for issue 18338. Changes output for --version and updates unit test accordingly.
msg192881 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-07-11 17:01
New changeset e6384b8b2325 by Serhiy Storchaka in branch 'default':
Issue #18338: `python --version` now prints version string to stdout, and
http://hg.python.org/cpython/rev/e6384b8b2325
msg197071 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-09-06 13:56
New changeset 587bdb940524 by Eli Bendersky in branch 'default':
Update whatsnew/3.4 wrt. --version going to stdout. #18338, #18920, #18922
http://hg.python.org/cpython/rev/587bdb940524
msg314370 - (view) Author: Stefan Sauer (Stefan Sauer) Date: 2018-03-24 14:44
Is there a workaround for python2? The issue is that autotools is checking that installed tools support --help and --version and it expects those to stdout:

bad=0; pid=$$; list="gtkdoc-check gtkdoc-depscan gtkdoc-fixxref gtkdoc-mkdb gtkdoc-mkhtml gtkdoc-mkhtml2 gtkdoc-mkman gtkdoc-mkpdf gtkdoc-rebase gtkdoc-scan gtkdoc-scangobj gtkdocize"; for p in $list; do \
  case '  ' in \
   *" $p "* | *" ../../$p "*) continue;; \
  esac; \
  f=`echo "$p" | sed 's,^.*/,,;s,x,x,'`; \
  for opt in --help --version; do \
    if "/home/ensonic/projects/gnome/gtk-doc/gtk-doc-1.27.1/_inst/bin/$f" $opt >c${pid}_.out \
         2>c${pid}_.err </dev/null \
	 && test -n "`cat c${pid}_.out`" \
	 && test -z "`cat c${pid}_.err`"; then :; \
    else echo "$f does not support $opt" 1>&2; bad=1; fi; \
  done; \
done; rm -f c${pid}_.???; exit $bad
gtkdoc-check does not support --version
gtkdoc-fixxref does not support --version
gtkdoc-mkdb does not support --version
gtkdoc-mkhtml does not support --version
gtkdoc-mkhtml2 does not support --version
gtkdoc-mkman does not support --version
gtkdoc-mkpdf does not support --version
gtkdoc-rebase does not support --version
gtkdoc-scan does not support --version
gtkdoc-scangobj does not support --version
Makefile:637: recipe for target 'installcheck-binSCRIPTS' failed
msg314372 - (view) Author: Stefan Sauer (Stefan Sauer) Date: 2018-03-24 15:00
Sorry need to find the ticket for argparse ..
History
Date User Action Args
2022-04-11 14:57:47adminsetgithub: 62538
2018-03-24 15:00:08Stefan Sauersetmessages: + msg314372
2018-03-24 14:44:24Stefan Sauersetnosy: + Stefan Sauer
messages: + msg314370
2013-09-06 13:56:38python-devsetmessages: + msg197071
2013-07-11 17:03:27serhiy.storchakasetstatus: open -> closed
assignee: serhiy.storchaka
resolution: fixed
stage: patch review -> resolved
2013-07-11 17:01:56python-devsetnosy: + python-dev
messages: + msg192881
2013-07-09 23:29:23Michael Dickenssetfiles: + issue18338.diff
nosy: + Michael Dickens
messages: + msg192784

2013-07-08 01:37:54Matthew.Byrnesetfiles: + issue18338.diff
nosy: + Matthew.Byrne
messages: + msg192605

2013-07-04 04:30:25Ramchandra Aptesetmessages: + msg192270
2013-07-04 04:29:41Ramchandra Aptesetmessages: + msg192269
2013-07-03 10:36:58serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg192228
2013-07-03 09:46:24berker.peksagsetfiles: + issue18338.diff

nosy: + berker.peksag
messages: + msg192225

keywords: + patch
stage: needs patch -> patch review
2013-07-02 14:24:29Ramchandra Aptesetnosy: + Ramchandra Apte
messages: + msg192198
2013-07-02 00:03:25vstinnersetkeywords: + easy
2013-07-02 00:01:06vstinnersettitle: option --version should send output to STDOUT -> python --version should send output to STDOUT
2013-07-01 11:22:55christian.heimessetversions: + Python 3.4, - Python 2.7
nosy: + christian.heimes

messages: + msg192122

type: behavior
stage: needs patch
2013-07-01 11:01:27jaaltocreate