-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
argparse version action should print to stdout, not stderr #63120
Comments
Hi, |
Yes, it seems like an oversight to me. Printing --version to stdout is more customary (Python itself does it, and most other tools do too). A question comes up about backwards compatibility. I would definitely not change it in 2.x - it's just not worth it. As for 3.x, should this go into 3.3 too or just 3.4? |
Only on 3.4. 3.4$ ./python -V 2> /dev/null This might also explain why argparse uses stderr (other modules/scripts in the stdlib might do the same too). |
On Wed, Sep 4, 2013 at 6:26 AM, Ezio Melotti <report@bugs.python.org> wrote:
Ah, right. On 3.4 Python's main.c uses printf for --version; on earlier I guess it's a no-brainer then; 3.4 has to be changed, but not earlier |
The Python executable change is from bpo-18338 |
Patch attached |
Lib/trace.py, Tools/pynche/Main.py, and Tools/i18n/pygettext.py write to the stdout. Lib/smtpd.py and Tools/i18n/msgfmt.py write to the stderr. The optparse module also writes to the stdout. |
You misplace Misc/NEWS entry in wrong section -- "What's New in Python 3.4.0 Alpha 1". I think this change (as change of bpo-18338) worths the mentioning in Doc/whatsnew/3.4.rst. Did you run all test suite? This change can affect other tests. |
New changeset ec9a4b77f37b by Eli Bendersky in branch 'default': |
Thanks, I moved the NEWS entry to the right place. Yes, all tests pass. I'll update whatsnew separately. |
New changeset 587bdb940524 by Eli Bendersky in branch 'default': |
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 |
You can implement your own version action which outputs to stdout and use it for -V and --version. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: