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

python --version should send output to STDOUT #62538

Closed
jaalto mannequin opened this issue Jul 1, 2013 · 13 comments
Closed

python --version should send output to STDOUT #62538

jaalto mannequin opened this issue Jul 1, 2013 · 13 comments
Assignees
Labels
easy interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@jaalto
Copy link
Mannequin

jaalto mannequin commented Jul 1, 2013

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']

    @jaalto
    Copy link
    Mannequin Author

    jaalto mannequin commented Jul 1, 2013

    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)

    @jaalto jaalto mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Jul 1, 2013
    @tiran
    Copy link
    Member

    tiran commented Jul 1, 2013

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

    @tiran tiran added the type-bug An unexpected behavior, bug, or error label Jul 1, 2013
    @vstinner vstinner changed the title option --version should send output to STDOUT python --version should send output to STDOUT Jul 2, 2013
    @vstinner vstinner added the easy label Jul 2, 2013
    @RamchandraApte
    Copy link
    Mannequin

    RamchandraApte mannequin commented Jul 2, 2013

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

    Agree.

    @berkerpeksag
    Copy link
    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

    @serhiy-storchaka
    Copy link
    Member

    LGTM.

    @RamchandraApte
    Copy link
    Mannequin

    RamchandraApte mannequin commented Jul 4, 2013

    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.

    @RamchandraApte
    Copy link
    Mannequin

    RamchandraApte mannequin commented Jul 4, 2013

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


    @MatthewByrne
    Copy link
    Mannequin

    MatthewByrne mannequin commented Jul 8, 2013

    Simply replced printout from stderr to stdout.

    @MichaelDickens
    Copy link
    Mannequin

    MichaelDickens mannequin commented Jul 9, 2013

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

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jul 11, 2013

    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

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 6, 2013

    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

    @StefanSauer
    Copy link
    Mannequin

    StefanSauer mannequin commented Mar 24, 2018

    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

    @StefanSauer
    Copy link
    Mannequin

    StefanSauer mannequin commented Mar 24, 2018

    Sorry need to find the ticket for argparse ..

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    easy interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants