PythonScript@0 - Python スクリプト v0 タスク

このタスクを使用して、Python ファイルまたはインライン スクリプトを実行します。

構文

# Python script v0
# Run a Python file or inline script.
- task: PythonScript@0
  inputs:
    scriptSource: 'filePath' # 'filePath' | 'inline'. Required. Script source. Default: filePath.
    scriptPath: # string. Required when scriptSource = filePath. Script path. 
    #script: # string. Required when scriptSource = inline. Script. 
    #arguments: # string. Arguments. 
  # Advanced
    #pythonInterpreter: # string. Python interpreter. 
    #workingDirectory: # string. Working directory. 
    #failOnStderr: false # boolean. Fail on standard error. Default: false.
# Python Script v0
# Run a Python script.
- task: PythonScript@0
  inputs:
    scriptSource: 'filePath' # 'filePath' | 'inline'. Required. Script source. Default: filePath.
    scriptPath: # string. Required when scriptSource = filePath. Script path. 
    #script: # string. Required when scriptSource = inline. Script. 
    #arguments: # string. Arguments. 
  # Advanced
    #pythonInterpreter: # string. Python interpreter. 
    #workingDirectory: # string. Working directory. 
    #failOnStderr: false # boolean. Fail on standard error. Default: false.

入力

scriptSource - スクリプト ソース
string. 必須です。 使用できる値: filePath (ファイル パス)、 inline。 既定値: filePath

スクリプトがソース ツリー内のファイルであるか、このタスクでインラインで書き込まれるかを指定します。


scriptPath - スクリプト パス
string. の場合は scriptSource = filePath必須です。

実行するスクリプトのパスを指定します。 完全修飾パスであるか、 に対する $(System.DefaultWorkingDirectory)相対パスである必要があります。


script - スクリプト
string. の場合は scriptSource = inline必須です。

実行する Python スクリプトを指定します。


arguments - 引数
string.

を使用して sys.argv使用できるスクリプト実行に渡される引数を、コマンド ラインで渡した場合と同様に指定します。


pythonInterpreter - Python インタープリター
string.

使用する Python インタープリターへの絶対パスを指定します。 指定しない場合、タスクは PATH でインタープリターを使用します。
[Python バージョンの使用] タスクを実行して、Python のバージョンを PATH に追加します。


workingDirectory - 作業ディレクトリ
string.

スクリプトを実行する作業ディレクトリを指定します。 指定しない場合は、 の System.DefaultWorkingDirectory 値が使用されます。 ビルドの場合、この変数は既定でリポジトリのルートに設定されます。 リリースの場合、既定値は artifacts ディレクトリのルートです。


failOnStderr - 標準エラーで失敗する
boolean. 既定値: false

に設定すると、ストリームに trueテキストが書き込まれた場合、 stderr このタスクは失敗します。


タスク コントロール のオプション

すべてのタスクには、タスク入力に加えて制御オプションがあります。 詳細については、「 コントロール オプションと一般的なタスク プロパティ」を参照してください。

出力変数

[なし] :

解説

既定では、このタスクはシステム パスからを呼び出 python します。 [ Python バージョンを使用する ] を実行して、必要なバージョンをシステム パスに配置します。

要件

要件 説明
パイプラインの種類 YAML、クラシック ビルド、クラシック リリース
実行日 エージェント、DeploymentGroup
確認要求 なし
Capabilities このタスクは、ジョブ内の後続のタスクに対する要求を満たしていません。
コマンドの制限 Any
設定可能な変数 Any
エージェントのバージョン サポートされているすべてのエージェント バージョン。
タスクのカテゴリ ユーティリティ