[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'
paul j3
report at bugs.python.org
Wed Dec 14 14:10:41 EST 2016
paul j3 added the comment:
The problem with Python2.7 is that 'open' does not take 'closefd', or any of the other parameters that were added for Python3.
open(name[, mode[, buffering]])
'rb' may make a difference on Py2 on Windows, but I haven't done any work in the environment in a long time.
I wasn't aware of that other issue. Some core Python developers have participated in that one. I suspect a lot of the discussion is beyond my level of expertise.
I once wrote that I thought 'FileType' was included primarily as an example of a 'type' factory. Something users could copy and extend for their own use. Bethard corrected me, saying that it was meant for quick-n-dirty script uses, ones with an input file, output file and a few options. In a bigger scripts, the users are encouraged to open/close files in 'with' contexts.
See http://bugs.python.org/issue22884 and the issues I reference there.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14156>
_______________________________________
More information about the Python-bugs-list
mailing list