A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2009-October/092742.html below:

[Python-Dev] PEP 389: argparse - new command line parsing module

[Python-Dev] PEP 389: argparse - new command line parsing module [Python-Dev] PEP 389: argparse - new command line parsing moduleAntoine Pitrou solipsis at pitrou.net
Thu Oct 8 00:24:08 CEST 2009
Hrvoje Niksic <hrvoje.niksic <at> 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.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4