This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.j3
Recipients David.Layton, Paolo.Elvati, Stefan.Pfeiffer, bethard, eric.araujo, manveru, paul.j3
Date 2014-04-01.07:36:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1396337811.53.0.995154993809.issue13824@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-04-01 07:36:51paul.j3setrecipients: + paul.j3, bethard, eric.araujo, Paolo.Elvati, manveru, Stefan.Pfeiffer, David.Layton
2014-04-01 07:36:51paul.j3setmessageid: <1396337811.53.0.995154993809.issue13824@psf.upfronthosting.co.za>
2014-04-01 07:36:51paul.j3linkissue13824 messages
2014-04-01 07:36:50paul.j3create