[issue21416] argparse should accept bytes arguments as originally passed

paul j3 report at bugs.python.org
Wed May 28 06:33:38 CEST 2014

paul j3 added the comment:

'invalid bytes value' is the error message generated by 'argparse'.  The underlying error (for a string like 'xxx') is:

    TypeError: string argument without an encoding

You could use 'bytes' if you somehow supply the encoding, as in:

    def mybytes(astr):
       return bytes(astr, 'utf-8')


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list