From: Inada Naoki Date: Sat, 30 Mar 2019 05:32:08 +0000 (+0900) Subject: bpo-17110: doc: add note how to get bytes from sys.argv (GH-12602) X-Git-Tag: v3.8.0a4~294 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=38f4e468d4b55551e135c67337c18ae142193ba8;p=thirdparty%2FPython%2Fcpython.git bpo-17110: doc: add note how to get bytes from sys.argv (GH-12602) --- diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 0fa5bd462294..52026f6a2bce 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -30,6 +30,12 @@ always available. To loop over the standard input, or the list of files given on the command line, see the :mod:`fileinput` module. + .. note:: + On Unix, command line arguments are passed by bytes from OS. Python decodes + them with filesystem encoding and "surrogateescape" error handler. + When you need original bytes, you can get it by + ``[os.fsencode(arg) for arg in sys.argv]``. + .. data:: base_exec_prefix