paul j3 added the comment:

>From http://bugs.python.org/issue14156 
"argparse.FileType for '-' doesn't work for a mode of 'rb'"

I learned that 'stdin/out' can be embedded in an 'open' by using the 'fileno()' 
and 'closefd=False' (so it isn't closed at the end of open).

With this, the dummy file context that I implemented in the previous patch, 
could be replaced with:

    partial(open, sys.stdin.fileno(), mode=self._mode,..., closefd=False)

However, as Steven Bethard wrote in the earlier issue, setting up tests when 
stdin/out will be redirected is not a trivial problem.  So I don't yet have a 
testable patch.

---------------
And just for the record, the 'osaccess' testing that I wrote earlier, probably 
should also test that proposed output file string is not already a directory.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13824>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to