Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les fondamentaux
Voir le programme détaillé
Module « subprocess » Python 3.13.2

Classe « Popen »

Informations générales

Héritage

builtins.object
    Popen

Définition

class Popen(builtins.object):

help(Popen)

Execute a child program in a new process.

For a complete description of the arguments see the Python documentation.

Arguments:
  args: A string, or a sequence of program arguments.

  bufsize: supplied as the buffering argument to the open() function when
      creating the stdin/stdout/stderr pipe file objects

  executable: A replacement program to execute.

  stdin, stdout and stderr: These specify the executed programs' standard
      input, standard output and standard error file handles, respectively.

  preexec_fn: (POSIX only) An object to be called in the child process
      just before the child is executed.

  close_fds: Controls closing or inheriting of file descriptors.

  shell: If true, the command will be executed through the shell.

  cwd: Sets the current directory before the child is executed.

  env: Defines the environment variables for the new process.

  text: If true, decode stdin, stdout and stderr using the given encoding
      (if set) or the system default otherwise.

  universal_newlines: Alias of text, provided for backwards compatibility.

  startupinfo and creationflags (Windows only)

  restore_signals (POSIX only)

  start_new_session (POSIX only)

  process_group (POSIX only)

  group (POSIX only)

  extra_groups (POSIX only)

  user (POSIX only)

  umask (POSIX only)

  pass_fds (POSIX only)

  encoding and errors: Text mode encoding and error handling to use for
      file objects stdin, stdout and stderr.

Attributes:
    stdin, stdout, stderr, pid, returncode

Constructeur(s)

Signature du constructeur Description
__init__(self, args, bufsize=-1, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=True, shell=False, cwd=None, env=None, universal_newlines=None, startupinfo=None, creationflags=0, restore_signals=True, start_new_session=False, pass_fds=(), *, user=None, group=None, extra_groups=None, encoding=None, errors=None, text=None, umask=-1, pipesize=-1, process_group=None) Create new Popen instance. [extrait de __init__.__doc__]

Liste des propriétés

Nom de la propriétéDescription
universal_newlines

Liste des opérateurs

Opérateurs hérités de la classe object

__eq__, __ge__, __gt__, __le__, __lt__, __ne__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__del__(self, _maxsize=9223372036854775807, _warn=<built-in function warn>)
__enter__(self)
__exit__(self, exc_type, value, traceback)
__repr__(self)
communicate(self, input=None, timeout=None) Interact with process: Send data to stdin and close it. [extrait de communicate.__doc__]
kill(self) Terminates the process. [extrait de terminate.__doc__]
poll(self) Check if child process has terminated. Set and return returncode [extrait de poll.__doc__]
send_signal(self, sig) Send a signal to the process. [extrait de send_signal.__doc__]
terminate(self) Terminates the process. [extrait de terminate.__doc__]
wait(self, timeout=None) Wait for child process to terminate; returns self.returncode. [extrait de wait.__doc__]

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __getattribute__, __getstate__, __hash__, __init_subclass__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les compléments
Voir le programme détaillé