Skip to content

python --version should send output to STDOUT #62538

Closed

Description

@jaalto
mannequin
BPO 18338
Nosy @tiran, @berkerpeksag, @serhiy-storchaka
Files
  • issue18338.diff
  • issue18338.diff: Patch for issue 18338
  • issue18338.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2013-07-11.17:03:27.844>
    created_at = <Date 2013-07-01.11:01:27.276>
    labels = ['interpreter-core', 'easy', 'type-bug']
    title = 'python --version should send output to STDOUT'
    updated_at = <Date 2018-03-24.15:00:08.695>
    user = 'https://bugs.python.org/jaalto'

    bugs.python.org fields:

    activity = <Date 2018-03-24.15:00:08.695>
    actor = 'Stefan Sauer'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2013-07-11.17:03:27.844>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2013-07-01.11:01:27.276>
    creator = 'jaalto'
    dependencies = []
    files = ['30756', '30848', '30881']
    hgrepos = []
    issue_num = 18338
    keywords = ['patch', 'easy']
    message_count = 13.0
    messages = ['192119', '192122', '192198', '192225', '192228', '192269', '192270', '192605', '192784', '192881', '197071', '314370', '314372']
    nosy_count = 9.0
    nosy_names = ['jaalto', 'christian.heimes', 'python-dev', 'Ramchandra Apte', 'berker.peksag', 'serhiy.storchaka', 'Matthew.Byrne', 'Michael Dickens', 'Stefan Sauer']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue18338'
    versions = ['Python 3.4']

    Activity

    1. jaalto commented on Jul 1, 2013

      jaaltomannequin
      MannequinAuthor

      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)

    2. tiran commented on Jul 1, 2013

      @tiran
      Member

      Your proposal is reasonable. I'm flagging it for Python 3.4+ as it's a backward incompatible modification.

    3. added
      type-bugAn unexpected behavior, bug, or error
      on Jul 1, 2013
    4. changed the title [-]option --version should send output to STDOUT[/-] [+]python --version should send output to STDOUT[/+] on Jul 2, 2013
    5. RamchandraApte commented on Jul 2, 2013

      RamchandraAptemannequin
      Mannequin

      Your proposal is reasonable. I'm flagging it for Python 3.4+ as it's a backward incompatible modification.

      Agree.

    6. berkerpeksag commented on Jul 3, 2013

      @berkerpeksag
      Member

      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

    7. serhiy-storchaka commented on Jul 3, 2013

      @serhiy-storchaka
      Member

      LGTM.

    8. RamchandraApte commented on Jul 4, 2013

      RamchandraAptemannequin
      Mannequin

      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.

    9. RamchandraApte commented on Jul 4, 2013

      RamchandraAptemannequin
      Mannequin

      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\>


    10. MatthewByrne commented on Jul 8, 2013

      MatthewByrnemannequin
      Mannequin

      Simply replced printout from stderr to stdout.

    11. MichaelDickens commented on Jul 9, 2013

      MichaelDickensmannequin
      Mannequin

      Patch for bpo-18338. Changes output for --version and updates unit test accordingly.

    12. python-dev commented on Jul 11, 2013

      python-devmannequin
      Mannequin

      New changeset e6384b8b2325 by Serhiy Storchaka in branch 'default':
      Issue bpo-18338: python --version now prints version string to stdout, and
      http://hg.python.org/cpython/rev/e6384b8b2325

    13. python-dev commented on Sep 6, 2013

      python-devmannequin
      Mannequin

      New changeset 587bdb940524 by Eli Bendersky in branch 'default':
      Update whatsnew/3.4 wrt. --version going to stdout. bpo-18338, bpo-18920, bpo-18922
      http://hg.python.org/cpython/rev/587bdb940524

    14. StefanSauer commented on Mar 24, 2018

      StefanSauermannequin
      Mannequin

      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
    15. StefanSauer commented on Mar 24, 2018

      StefanSauermannequin
      Mannequin

      Sorry need to find the ticket for argparse ..

    16. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    easyinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions