Python Script task

Azure Pipelines

Use this task in a build or release pipeline to run a Python script.

YAML snippet

# Python script
# Run a Python file or inline script
- task: PythonScript@0
    #scriptSource: 'filePath' # Options: filePath, inline
    #scriptPath: # Required when scriptSource == FilePath
    #script: # Required when scriptSource == Inline
    #arguments: # Optional
    #pythonInterpreter: # Optional
    #workingDirectory: # Optional
    #failOnStderr: false # Optional


Type(Required) Target script type: File path or Inline
Script Path(Required when targetType == filePath) Path of the script to execute. Must be a fully qualified path or relative to $(System.DefaultWorkingDirectory).
Script(Required when targetType == inline) The Python script to run
Arguments(Optional) Arguments passed to the script execution, available through sys.argv.
Python interpreter(Optional) Absolute path to the Python interpreter to use. If not specified, the task assumes a Python interpreter is available on the PATH and simply attempts to run the python command.
Working directory(Optional) undefined
Fail on standard error(Optional) If this is true, this task will fail if any text are written to the stderr stream.
Control options


By default, this task will invoke python from the system path. Run Use Python Version to put the version you want in the system path.

Open source

This task is open source on GitHub. Feedback and contributions are welcome.