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. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com