New submission from Derek Wilson: If I create an argument parser like:
parser = argparse.ArgumentParser() parser.add_argument('somebytes', type=bytes, help='i want some bytes') parser.parse_args() the parse_args() call will raise an exception printing usage info indicating that an "invalid bytes value" was passed if any of the bytes on the command line are >127. if i'm specifying that i want bytes then i should expect that the argument should be interpreted as bytes and not text. I get that #8776 was closed because it makes sense not to clutter up internals, but in this instance i am building a command line parser and telling it exactly what i expect. if the solution from #8776 of os.fsencode(sys.argv) will definitely always work then argparse should do this internally if i tell it i expect bytes on the command line. ---------- components: Library (Lib) messages: 217761 nosy: underrun priority: normal severity: normal status: open title: argparse should accept bytes arguments as originally passed type: behavior versions: Python 3.4, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21416> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com