Hello,
in Python 3, this is a TypeError:
>>> sys.stdout.write(b"hello, world\n")
At the moment, argparse.FileType.__call__("-") unconditionally returns
sys.stdout even if mode is binary so writing binary data will fail if
the user selects to write it to stdout.
I'm not sure if this is the best possible solution but at least the
following patch to argparse.py would fix the aforementioned problem.
Moritz
1154c1154,1157
< return _sys.stdin
---
> if 'b' in self._mode:
> return _sys.stdin.buffer
> else:
> return _sys.stdin
1156c1159,1162
< return _sys.stdout
---
> if 'b' in self._mode:
> return _sys.stdout.buffer
> else:
> return _sys.stdout
--
Fingerprint: 80C1 EC79 B554 3D84 0A35 A728 7057 B288 CE61 2235
Public key: http://openpgp.klammler.eu