forked from AFPy/python-docs-fr
929 lines
32 KiB
Plaintext
929 lines
32 KiB
Plaintext
# SOME DESCRIPTIVE TITLE.
|
|
# Copyright (C) 1990-2016, Python Software Foundation
|
|
# This file is distributed under the same license as the Python package.
|
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
#
|
|
#, fuzzy
|
|
msgid ""
|
|
msgstr ""
|
|
"Project-Id-Version: Python 2.7\n"
|
|
"Report-Msgid-Bugs-To: \n"
|
|
"POT-Creation-Date: 2016-10-30 10:44+0100\n"
|
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
"MIME-Version: 1.0\n"
|
|
"Content-Type: text/plain; charset=UTF-8\n"
|
|
"Content-Transfer-Encoding: 8bit\n"
|
|
|
|
#: ../Doc/library/subprocess.rst:3
|
|
msgid ":mod:`subprocess` --- Subprocess management"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:13
|
|
msgid ""
|
|
"The :mod:`subprocess` module allows you to spawn new processes, connect to "
|
|
"their input/output/error pipes, and obtain their return codes. This module "
|
|
"intends to replace several older modules and functions::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:23
|
|
msgid ""
|
|
"Information about how this module can be used to replace the older functions "
|
|
"can be found in the subprocess-replacements_ section."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:28
|
|
msgid ""
|
|
"POSIX users (Linux, BSD, etc.) are strongly encouraged to install and use "
|
|
"the much more recent subprocess32_ module instead of the version included "
|
|
"with python 2.7. It is a drop in replacement with better behavior in many "
|
|
"situations."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:33
|
|
msgid ":pep:`324` -- PEP proposing the subprocess module"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:38
|
|
msgid "Using the :mod:`subprocess` Module"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:40
|
|
msgid ""
|
|
"The recommended way to launch subprocesses is to use the following "
|
|
"convenience functions. For more advanced use cases when these do not meet "
|
|
"your needs, use the underlying :class:`Popen` interface."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:47
|
|
msgid ""
|
|
"Run the command described by *args*. Wait for command to complete, then "
|
|
"return the :attr:`returncode` attribute."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:50 ../Doc/library/subprocess.rst:84
|
|
msgid ""
|
|
"The arguments shown above are merely the most common ones, described below "
|
|
"in :ref:`frequently-used-arguments` (hence the slightly odd notation in the "
|
|
"abbreviated signature). The full function signature is the same as that of "
|
|
"the :class:`Popen` constructor - this functions passes all supplied "
|
|
"arguments directly through to that interface."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:56 ../Doc/library/subprocess.rst:90
|
|
#: ../Doc/library/subprocess.rst:131
|
|
msgid "Examples::"
|
|
msgstr "Exemples : ::"
|
|
|
|
#: ../Doc/library/subprocess.rst:66 ../Doc/library/subprocess.rst:104
|
|
#: ../Doc/library/subprocess.rst:154
|
|
msgid ""
|
|
"Using ``shell=True`` can be a security hazard. See the warning under :ref:"
|
|
"`frequently-used-arguments` for details."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:71 ../Doc/library/subprocess.rst:109
|
|
msgid ""
|
|
"Do not use ``stdout=PIPE`` or ``stderr=PIPE`` with this function as that can "
|
|
"deadlock based on the child process output volume. Use :class:`Popen` with "
|
|
"the :meth:`communicate` method when you need pipes."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:79
|
|
msgid ""
|
|
"Run command with arguments. Wait for command to complete. If the return "
|
|
"code was zero then return, otherwise raise :exc:`CalledProcessError`. The :"
|
|
"exc:`CalledProcessError` object will have the return code in the :attr:"
|
|
"`~CalledProcessError.returncode` attribute."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:117
|
|
msgid "Run command with arguments and return its output as a byte string."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:119
|
|
msgid ""
|
|
"If the return code was non-zero it raises a :exc:`CalledProcessError`. The :"
|
|
"exc:`CalledProcessError` object will have the return code in the :attr:"
|
|
"`~CalledProcessError.returncode` attribute and any output in the :attr:"
|
|
"`~CalledProcessError.output` attribute."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:124
|
|
msgid ""
|
|
"The arguments shown above are merely the most common ones, described below "
|
|
"in :ref:`frequently-used-arguments` (hence the slightly odd notation in the "
|
|
"abbreviated signature). The full function signature is largely the same as "
|
|
"that of the :class:`Popen` constructor, except that *stdout* is not "
|
|
"permitted as it is used internally. All other supplied arguments are passed "
|
|
"directly through to the :class:`Popen` constructor."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:141
|
|
msgid ""
|
|
"To also capture standard error in the result, use ``stderr=subprocess."
|
|
"STDOUT``::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:159
|
|
msgid ""
|
|
"Do not use ``stderr=PIPE`` with this function as that can deadlock based on "
|
|
"the child process error volume. Use :class:`Popen` with the :meth:"
|
|
"`communicate` method when you need a stderr pipe."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:166
|
|
msgid ""
|
|
"Special value that can be used as the *stdin*, *stdout* or *stderr* argument "
|
|
"to :class:`Popen` and indicates that a pipe to the standard stream should be "
|
|
"opened."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:173
|
|
msgid ""
|
|
"Special value that can be used as the *stderr* argument to :class:`Popen` "
|
|
"and indicates that standard error should go into the same handle as standard "
|
|
"output."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:180
|
|
msgid ""
|
|
"Exception raised when a process run by :func:`check_call` or :func:"
|
|
"`check_output` returns a non-zero exit status."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:185
|
|
msgid "Exit status of the child process."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:189
|
|
msgid "Command that was used to spawn the child process."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:193
|
|
msgid ""
|
|
"Output of the child process if this exception is raised by :func:"
|
|
"`check_output`. Otherwise, ``None``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:201
|
|
msgid "Frequently Used Arguments"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:203
|
|
msgid ""
|
|
"To support a wide variety of use cases, the :class:`Popen` constructor (and "
|
|
"the convenience functions) accept a large number of optional arguments. For "
|
|
"most typical use cases, many of these arguments can be safely left at their "
|
|
"default values. The arguments that are most commonly needed are:"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:208
|
|
msgid ""
|
|
"*args* is required for all calls and should be a string, or a sequence of "
|
|
"program arguments. Providing a sequence of arguments is generally preferred, "
|
|
"as it allows the module to take care of any required escaping and quoting of "
|
|
"arguments (e.g. to permit spaces in file names). If passing a single string, "
|
|
"either *shell* must be :const:`True` (see below) or else the string must "
|
|
"simply name the program to be executed without specifying any arguments."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:216 ../Doc/library/subprocess.rst:372
|
|
msgid ""
|
|
"*stdin*, *stdout* and *stderr* specify the executed program's standard "
|
|
"input, standard output and standard error file handles, respectively. Valid "
|
|
"values are :data:`PIPE`, an existing file descriptor (a positive integer), "
|
|
"an existing file object, and ``None``. :data:`PIPE` indicates that a new "
|
|
"pipe to the child should be created. With the default settings of ``None``, "
|
|
"no redirection will occur; the child's file handles will be inherited from "
|
|
"the parent. Additionally, *stderr* can be :data:`STDOUT`, which indicates "
|
|
"that the stderr data from the child process should be captured into the same "
|
|
"file handle as for stdout."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:229
|
|
msgid ""
|
|
"When *stdout* or *stderr* are pipes and *universal_newlines* is ``True`` "
|
|
"then all line endings will be converted to ``'\\n'`` as described for the :"
|
|
"term:`universal newlines` ``'U'`` mode argument to :func:`open`."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:233
|
|
msgid ""
|
|
"If *shell* is ``True``, the specified command will be executed through the "
|
|
"shell. This can be useful if you are using Python primarily for the "
|
|
"enhanced control flow it offers over most system shells and still want "
|
|
"convenient access to other shell features such as shell pipes, filename "
|
|
"wildcards, environment variable expansion, and expansion of ``~`` to a "
|
|
"user's home directory. However, note that Python itself offers "
|
|
"implementations of many shell-like features (in particular, :mod:`glob`, :"
|
|
"mod:`fnmatch`, :func:`os.walk`, :func:`os.path.expandvars`, :func:`os.path."
|
|
"expanduser`, and :mod:`shutil`)."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:245
|
|
msgid ""
|
|
"Executing shell commands that incorporate unsanitized input from an "
|
|
"untrusted source makes a program vulnerable to `shell injection <http://en."
|
|
"wikipedia.org/wiki/Shell_injection#Shell_injection>`_, a serious security "
|
|
"flaw which can result in arbitrary command execution. For this reason, the "
|
|
"use of ``shell=True`` is **strongly discouraged** in cases where the command "
|
|
"string is constructed from external input::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:258
|
|
msgid ""
|
|
"``shell=False`` disables all shell based features, but does not suffer from "
|
|
"this vulnerability; see the Note in the :class:`Popen` constructor "
|
|
"documentation for helpful hints in getting ``shell=False`` to work."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:262
|
|
msgid ""
|
|
"When using ``shell=True``, :func:`pipes.quote` can be used to properly "
|
|
"escape whitespace and shell metacharacters in strings that are going to be "
|
|
"used to construct shell commands."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:266
|
|
msgid ""
|
|
"These options, along with all of the other options, are described in more "
|
|
"detail in the :class:`Popen` constructor documentation."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:271
|
|
msgid "Popen Constructor"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:273
|
|
msgid ""
|
|
"The underlying process creation and management in this module is handled by "
|
|
"the :class:`Popen` class. It offers a lot of flexibility so that developers "
|
|
"are able to handle the less common cases not covered by the convenience "
|
|
"functions."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:284
|
|
msgid ""
|
|
"Execute a child program in a new process. On Unix, the class uses :meth:`os."
|
|
"execvp`-like behavior to execute the child program. On Windows, the class "
|
|
"uses the Windows ``CreateProcess()`` function. The arguments to :class:"
|
|
"`Popen` are as follows."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:289
|
|
msgid ""
|
|
"*args* should be a sequence of program arguments or else a single string. By "
|
|
"default, the program to execute is the first item in *args* if *args* is a "
|
|
"sequence. If *args* is a string, the interpretation is platform-dependent "
|
|
"and described below. See the *shell* and *executable* arguments for "
|
|
"additional differences from the default behavior. Unless otherwise stated, "
|
|
"it is recommended to pass *args* as a sequence."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:296
|
|
msgid ""
|
|
"On Unix, if *args* is a string, the string is interpreted as the name or "
|
|
"path of the program to execute. However, this can only be done if not "
|
|
"passing arguments to the program."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:302
|
|
msgid ""
|
|
":meth:`shlex.split` can be useful when determining the correct tokenization "
|
|
"for *args*, especially in complex cases::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:313
|
|
msgid ""
|
|
"Note in particular that options (such as *-input*) and arguments (such as "
|
|
"*eggs.txt*) that are separated by whitespace in the shell go in separate "
|
|
"list elements, while arguments that need quoting or backslash escaping when "
|
|
"used in the shell (such as filenames containing spaces or the *echo* command "
|
|
"shown above) are single list elements."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:319
|
|
msgid ""
|
|
"On Windows, if *args* is a sequence, it will be converted to a string in a "
|
|
"manner described in :ref:`converting-argument-sequence`. This is because "
|
|
"the underlying ``CreateProcess()`` operates on strings."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:323
|
|
msgid ""
|
|
"The *shell* argument (which defaults to ``False``) specifies whether to use "
|
|
"the shell as the program to execute. If *shell* is ``True``, it is "
|
|
"recommended to pass *args* as a string rather than as a sequence."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:327
|
|
msgid ""
|
|
"On Unix with ``shell=True``, the shell defaults to :file:`/bin/sh`. If "
|
|
"*args* is a string, the string specifies the command to execute through the "
|
|
"shell. This means that the string must be formatted exactly as it would be "
|
|
"when typed at the shell prompt. This includes, for example, quoting or "
|
|
"backslash escaping filenames with spaces in them. If *args* is a sequence, "
|
|
"the first item specifies the command string, and any additional items will "
|
|
"be treated as additional arguments to the shell itself. That is to say, :"
|
|
"class:`Popen` does the equivalent of::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:338
|
|
msgid ""
|
|
"On Windows with ``shell=True``, the :envvar:`COMSPEC` environment variable "
|
|
"specifies the default shell. The only time you need to specify "
|
|
"``shell=True`` on Windows is when the command you wish to execute is built "
|
|
"into the shell (e.g. :command:`dir` or :command:`copy`). You do not need "
|
|
"``shell=True`` to run a batch file or console-based executable."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:346
|
|
msgid ""
|
|
"Passing ``shell=True`` can be a security hazard if combined with untrusted "
|
|
"input. See the warning under :ref:`frequently-used-arguments` for details."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:350
|
|
msgid ""
|
|
"*bufsize*, if given, has the same meaning as the corresponding argument to "
|
|
"the built-in open() function: :const:`0` means unbuffered, :const:`1` means "
|
|
"line buffered, any other positive value means use a buffer of "
|
|
"(approximately) that size. A negative *bufsize* means to use the system "
|
|
"default, which usually means fully buffered. The default value for "
|
|
"*bufsize* is :const:`0` (unbuffered)."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:358
|
|
msgid ""
|
|
"If you experience performance issues, it is recommended that you try to "
|
|
"enable buffering by setting *bufsize* to either -1 or a large enough "
|
|
"positive value (such as 4096)."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:362
|
|
msgid ""
|
|
"The *executable* argument specifies a replacement program to execute. It "
|
|
"is very seldom needed. When ``shell=False``, *executable* replaces the "
|
|
"program to execute specified by *args*. However, the original *args* is "
|
|
"still passed to the program. Most programs treat the program specified by "
|
|
"*args* as the command name, which can then be different from the program "
|
|
"actually executed. On Unix, the *args* name becomes the display name for "
|
|
"the executable in utilities such as :program:`ps`. If ``shell=True``, on "
|
|
"Unix the *executable* argument specifies a replacement shell for the "
|
|
"default :file:`/bin/sh`."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:382
|
|
msgid ""
|
|
"If *preexec_fn* is set to a callable object, this object will be called in "
|
|
"the child process just before the child is executed. (Unix only)"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:385
|
|
msgid ""
|
|
"If *close_fds* is true, all file descriptors except :const:`0`, :const:`1` "
|
|
"and :const:`2` will be closed before the child process is executed. (Unix "
|
|
"only). Or, on Windows, if *close_fds* is true then no handles will be "
|
|
"inherited by the child process. Note that on Windows, you cannot set "
|
|
"*close_fds* to true and also redirect the standard handles by setting "
|
|
"*stdin*, *stdout* or *stderr*."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:391
|
|
msgid ""
|
|
"If *cwd* is not ``None``, the child's current directory will be changed to "
|
|
"*cwd* before it is executed. Note that this directory is not considered "
|
|
"when searching the executable, so you can't specify the program's path "
|
|
"relative to *cwd*."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:396
|
|
msgid ""
|
|
"If *env* is not ``None``, it must be a mapping that defines the environment "
|
|
"variables for the new process; these are used instead of inheriting the "
|
|
"current process' environment, which is the default behavior."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:402
|
|
msgid ""
|
|
"If specified, *env* must provide any variables required for the program to "
|
|
"execute. On Windows, in order to run a `side-by-side assembly`_ the "
|
|
"specified *env* **must** include a valid :envvar:`SystemRoot`."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:409
|
|
msgid ""
|
|
"If *universal_newlines* is ``True``, the file objects *stdout* and *stderr* "
|
|
"are opened as text files in :term:`universal newlines` mode. Lines may be "
|
|
"terminated by any of ``'\\n'``, the Unix end-of-line convention, ``'\\r'``, "
|
|
"the old Macintosh convention or ``'\\r\\n'``, the Windows convention. All of "
|
|
"these external representations are seen as ``'\\n'`` by the Python program."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:417
|
|
msgid ""
|
|
"This feature is only available if Python is built with universal newline "
|
|
"support (the default). Also, the newlines attribute of the file objects :"
|
|
"attr:`stdout`, :attr:`stdin` and :attr:`stderr` are not updated by the "
|
|
"communicate() method."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:422
|
|
msgid ""
|
|
"If given, *startupinfo* will be a :class:`STARTUPINFO` object, which is "
|
|
"passed to the underlying ``CreateProcess`` function. *creationflags*, if "
|
|
"given, can be :data:`CREATE_NEW_CONSOLE` or :data:"
|
|
"`CREATE_NEW_PROCESS_GROUP`. (Windows only)"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:429
|
|
msgid "Exceptions"
|
|
msgstr "Les exceptions"
|
|
|
|
#: ../Doc/library/subprocess.rst:431
|
|
msgid ""
|
|
"Exceptions raised in the child process, before the new program has started "
|
|
"to execute, will be re-raised in the parent. Additionally, the exception "
|
|
"object will have one extra attribute called :attr:`child_traceback`, which "
|
|
"is a string containing traceback information from the child's point of view."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:436
|
|
msgid ""
|
|
"The most common exception raised is :exc:`OSError`. This occurs, for "
|
|
"example, when trying to execute a non-existent file. Applications should "
|
|
"prepare for :exc:`OSError` exceptions."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:440
|
|
msgid ""
|
|
"A :exc:`ValueError` will be raised if :class:`Popen` is called with invalid "
|
|
"arguments."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:443
|
|
msgid ""
|
|
":func:`check_call` and :func:`check_output` will raise :exc:"
|
|
"`CalledProcessError` if the called process returns a non-zero return code."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:449
|
|
msgid "Security"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:451
|
|
msgid ""
|
|
"Unlike some other popen functions, this implementation will never call a "
|
|
"system shell implicitly. This means that all characters, including shell "
|
|
"metacharacters, can safely be passed to child processes. Obviously, if the "
|
|
"shell is invoked explicitly, then it is the application's responsibility to "
|
|
"ensure that all whitespace and metacharacters are quoted appropriately."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:459
|
|
msgid "Popen Objects"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:461
|
|
msgid "Instances of the :class:`Popen` class have the following methods:"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:466
|
|
msgid ""
|
|
"Check if child process has terminated. Set and return :attr:`~Popen."
|
|
"returncode` attribute."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:472
|
|
msgid ""
|
|
"Wait for child process to terminate. Set and return :attr:`~Popen."
|
|
"returncode` attribute."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:477
|
|
msgid ""
|
|
"This will deadlock when using ``stdout=PIPE`` and/or ``stderr=PIPE`` and the "
|
|
"child process generates enough output to a pipe such that it blocks waiting "
|
|
"for the OS pipe buffer to accept more data. Use :meth:`communicate` to "
|
|
"avoid that."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:485
|
|
msgid ""
|
|
"Interact with process: Send data to stdin. Read data from stdout and "
|
|
"stderr, until end-of-file is reached. Wait for process to terminate. The "
|
|
"optional *input* argument should be a string to be sent to the child "
|
|
"process, or ``None``, if no data should be sent to the child."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:490
|
|
msgid ":meth:`communicate` returns a tuple ``(stdoutdata, stderrdata)``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:492
|
|
msgid ""
|
|
"Note that if you want to send data to the process's stdin, you need to "
|
|
"create the Popen object with ``stdin=PIPE``. Similarly, to get anything "
|
|
"other than ``None`` in the result tuple, you need to give ``stdout=PIPE`` "
|
|
"and/or ``stderr=PIPE`` too."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:499
|
|
msgid ""
|
|
"The data read is buffered in memory, so do not use this method if the data "
|
|
"size is large or unlimited."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:505
|
|
msgid "Sends the signal *signal* to the child."
|
|
msgstr "Envoie le signal *signal* au fils."
|
|
|
|
#: ../Doc/library/subprocess.rst:509
|
|
msgid ""
|
|
"On Windows, SIGTERM is an alias for :meth:`terminate`. CTRL_C_EVENT and "
|
|
"CTRL_BREAK_EVENT can be sent to processes started with a *creationflags* "
|
|
"parameter which includes `CREATE_NEW_PROCESS_GROUP`."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:518
|
|
msgid ""
|
|
"Stop the child. On Posix OSs the method sends SIGTERM to the child. On "
|
|
"Windows the Win32 API function :c:func:`TerminateProcess` is called to stop "
|
|
"the child."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:527
|
|
msgid ""
|
|
"Kills the child. On Posix OSs the function sends SIGKILL to the child. On "
|
|
"Windows :meth:`kill` is an alias for :meth:`terminate`."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:533
|
|
msgid "The following attributes are also available:"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:537
|
|
msgid ""
|
|
"Use :meth:`~Popen.communicate` rather than :attr:`.stdin.write <Popen."
|
|
"stdin>`, :attr:`.stdout.read <Popen.stdout>` or :attr:`.stderr.read <Popen."
|
|
"stderr>` to avoid deadlocks due to any of the other OS pipe buffers filling "
|
|
"up and blocking the child process."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:545
|
|
msgid ""
|
|
"If the *stdin* argument was :data:`PIPE`, this attribute is a file object "
|
|
"that provides input to the child process. Otherwise, it is ``None``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:551
|
|
msgid ""
|
|
"If the *stdout* argument was :data:`PIPE`, this attribute is a file object "
|
|
"that provides output from the child process. Otherwise, it is ``None``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:557
|
|
msgid ""
|
|
"If the *stderr* argument was :data:`PIPE`, this attribute is a file object "
|
|
"that provides error output from the child process. Otherwise, it is "
|
|
"``None``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:564
|
|
msgid "The process ID of the child process."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:566
|
|
msgid ""
|
|
"Note that if you set the *shell* argument to ``True``, this is the process "
|
|
"ID of the spawned shell."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:572
|
|
msgid ""
|
|
"The child return code, set by :meth:`poll` and :meth:`wait` (and indirectly "
|
|
"by :meth:`communicate`). A ``None`` value indicates that the process hasn't "
|
|
"terminated yet."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:576
|
|
msgid ""
|
|
"A negative value ``-N`` indicates that the child was terminated by signal "
|
|
"``N`` (Unix only)."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:581
|
|
msgid "Windows Popen Helpers"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:583
|
|
msgid ""
|
|
"The :class:`STARTUPINFO` class and following constants are only available on "
|
|
"Windows."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:588
|
|
msgid ""
|
|
"Partial support of the Windows `STARTUPINFO <https://msdn.microsoft.com/en-"
|
|
"us/library/ms686331(v=vs.85).aspx>`__ structure is used for :class:`Popen` "
|
|
"creation."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:594
|
|
msgid ""
|
|
"A bit field that determines whether certain :class:`STARTUPINFO` attributes "
|
|
"are used when the process creates a window. ::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:602
|
|
msgid ""
|
|
"If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute is "
|
|
"the standard input handle for the process. If :data:`STARTF_USESTDHANDLES` "
|
|
"is not specified, the default for standard input is the keyboard buffer."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:609
|
|
msgid ""
|
|
"If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute is "
|
|
"the standard output handle for the process. Otherwise, this attribute is "
|
|
"ignored and the default for standard output is the console window's buffer."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:616
|
|
msgid ""
|
|
"If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute is "
|
|
"the standard error handle for the process. Otherwise, this attribute is "
|
|
"ignored and the default for standard error is the console window's buffer."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:622
|
|
msgid ""
|
|
"If :attr:`dwFlags` specifies :data:`STARTF_USESHOWWINDOW`, this attribute "
|
|
"can be any of the values that can be specified in the ``nCmdShow`` parameter "
|
|
"for the `ShowWindow <https://msdn.microsoft.com/en-us/library/"
|
|
"ms633548(v=vs.85).aspx>`__ function, except for ``SW_SHOWDEFAULT``. "
|
|
"Otherwise, this attribute is ignored."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:629
|
|
msgid ""
|
|
":data:`SW_HIDE` is provided for this attribute. It is used when :class:"
|
|
"`Popen` is called with ``shell=True``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:634
|
|
msgid "Constants"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:636
|
|
msgid "The :mod:`subprocess` module exposes the following constants."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:640
|
|
msgid ""
|
|
"The standard input device. Initially, this is the console input buffer, "
|
|
"``CONIN$``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:645
|
|
msgid ""
|
|
"The standard output device. Initially, this is the active console screen "
|
|
"buffer, ``CONOUT$``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:650
|
|
msgid ""
|
|
"The standard error device. Initially, this is the active console screen "
|
|
"buffer, ``CONOUT$``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:655
|
|
msgid "Hides the window. Another window will be activated."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:659
|
|
msgid ""
|
|
"Specifies that the :attr:`STARTUPINFO.hStdInput`, :attr:`STARTUPINFO."
|
|
"hStdOutput`, and :attr:`STARTUPINFO.hStdError` attributes contain additional "
|
|
"information."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:665
|
|
msgid ""
|
|
"Specifies that the :attr:`STARTUPINFO.wShowWindow` attribute contains "
|
|
"additional information."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:670
|
|
msgid ""
|
|
"The new process has a new console, instead of inheriting its parent's "
|
|
"console (the default)."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:673
|
|
msgid ""
|
|
"This flag is always set when :class:`Popen` is created with ``shell=True``."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:677
|
|
msgid ""
|
|
"A :class:`Popen` ``creationflags`` parameter to specify that a new process "
|
|
"group will be created. This flag is necessary for using :func:`os.kill` on "
|
|
"the subprocess."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:681
|
|
msgid "This flag is ignored if :data:`CREATE_NEW_CONSOLE` is specified."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:687
|
|
msgid "Replacing Older Functions with the :mod:`subprocess` Module"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:689
|
|
msgid ""
|
|
"In this section, \"a becomes b\" means that b can be used as a replacement "
|
|
"for a."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:693
|
|
msgid ""
|
|
"All \"a\" functions in this section fail (more or less) silently if the "
|
|
"executed program cannot be found; the \"b\" replacements raise :exc:"
|
|
"`OSError` instead."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:697
|
|
msgid ""
|
|
"In addition, the replacements using :func:`check_output` will fail with a :"
|
|
"exc:`CalledProcessError` if the requested operation produces a non-zero "
|
|
"return code. The output is still available as the :attr:`~CalledProcessError."
|
|
"output` attribute of the raised exception."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:702
|
|
msgid ""
|
|
"In the following examples, we assume that the relevant functions have "
|
|
"already been imported from the :mod:`subprocess` module."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:707
|
|
msgid "Replacing /bin/sh shell backquote"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:713 ../Doc/library/subprocess.rst:724
|
|
#: ../Doc/library/subprocess.rst:741
|
|
msgid "becomes::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:718
|
|
msgid "Replacing shell pipeline"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:731
|
|
msgid ""
|
|
"The p1.stdout.close() call after starting the p2 is important in order for "
|
|
"p1 to receive a SIGPIPE if p2 exits before p1."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:734
|
|
msgid ""
|
|
"Alternatively, for trusted input, the shell's own pipeline support may still "
|
|
"be used directly:"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:747
|
|
msgid "Replacing :func:`os.system`"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:755
|
|
msgid "Notes:"
|
|
msgstr "Notes : "
|
|
|
|
#: ../Doc/library/subprocess.rst:757
|
|
msgid "Calling the program through the shell is usually not required."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:759
|
|
msgid "A more realistic example would look like this::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:772
|
|
msgid "Replacing the :func:`os.spawn <os.spawnl>` family"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:774
|
|
msgid "P_NOWAIT example::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:780
|
|
msgid "P_WAIT example::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:786
|
|
msgid "Vector example::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:792
|
|
msgid "Environment example::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:800
|
|
msgid "Replacing :func:`os.popen`, :func:`os.popen2`, :func:`os.popen3`"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:843
|
|
msgid ""
|
|
"On Unix, os.popen2, os.popen3 and os.popen4 also accept a sequence as the "
|
|
"command to execute, in which case arguments will be passed directly to the "
|
|
"program without shell intervention. This usage can be replaced as follows::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:854
|
|
msgid "Return code handling translates as follows::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:870
|
|
msgid "Replacing functions from the :mod:`popen2` module"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:880
|
|
msgid ""
|
|
"On Unix, popen2 also accepts a sequence as the command to execute, in which "
|
|
"case arguments will be passed directly to the program without shell "
|
|
"intervention. This usage can be replaced as follows::"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:891
|
|
msgid ""
|
|
":class:`popen2.Popen3` and :class:`popen2.Popen4` basically work as :class:"
|
|
"`subprocess.Popen`, except that:"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:894
|
|
msgid ":class:`Popen` raises an exception if the execution fails."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:896
|
|
msgid "the *capturestderr* argument is replaced with the *stderr* argument."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:898
|
|
msgid "``stdin=PIPE`` and ``stdout=PIPE`` must be specified."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:900
|
|
msgid ""
|
|
"popen2 closes all file descriptors by default, but you have to specify "
|
|
"``close_fds=True`` with :class:`Popen`."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:905
|
|
msgid "Notes"
|
|
msgstr "Notes"
|
|
|
|
#: ../Doc/library/subprocess.rst:910
|
|
msgid "Converting an argument sequence to a string on Windows"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:912
|
|
msgid ""
|
|
"On Windows, an *args* sequence is converted to a string that can be parsed "
|
|
"using the following rules (which correspond to the rules used by the MS C "
|
|
"runtime):"
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:916
|
|
msgid ""
|
|
"Arguments are delimited by white space, which is either a space or a tab."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:919
|
|
msgid ""
|
|
"A string surrounded by double quotation marks is interpreted as a single "
|
|
"argument, regardless of white space contained within. A quoted string can "
|
|
"be embedded in an argument."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:924
|
|
msgid ""
|
|
"A double quotation mark preceded by a backslash is interpreted as a literal "
|
|
"double quotation mark."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:927
|
|
msgid ""
|
|
"Backslashes are interpreted literally, unless they immediately precede a "
|
|
"double quotation mark."
|
|
msgstr ""
|
|
|
|
#: ../Doc/library/subprocess.rst:930
|
|
msgid ""
|
|
"If backslashes immediately precede a double quotation mark, every pair of "
|
|
"backslashes is interpreted as a literal backslash. If the number of "
|
|
"backslashes is odd, the last backslash escapes the next double quotation "
|
|
"mark as described in rule 3."
|
|
msgstr ""
|