[Python-Dev] PEP 389: argparse - new command line parsing module (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Thu Oct 8 00:24:08 CEST 2009
- Previous message: [Python-Dev] PEP 389: argparse - new command line parsing module
- Next message: [Python-Dev] PEP 389: argparse - new command line parsing module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hrvoje Niksic <hrvoje.niksic avl.com> writes:
Of course; simply use the >&- pseudo-redirection, which has been a standard sh feature (later inherited by ksh and bash, but not csh) for ~30 years. The error message is amusing, too: $ python -c 'print "foo"' >&- close failed in file object destructor: Error in sys.excepthook: Original exception was:
Python 3 complains at startup and is a bit more explicit:
$ ./python -c '1' >&- Fatal Python error: Py_Initialize: can't initialize sys standard streams OSError: [Errno 9] Bad file descriptor Abandon
Of course, if it is stderr that you explicitly close, you lose all reporting:
$ ./python -c '1' 2>&- Abandon
Regards
Antoine.
- Previous message: [Python-Dev] PEP 389: argparse - new command line parsing module
- Next message: [Python-Dev] PEP 389: argparse - new command line parsing module
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]