Reputation: 21
I'm trying to run this python task in azure pipeline.
- task: PythonScript@0
inputs:
scriptSource: 'inline'
script: |
import json
import os
import requests
from requests.auth import HTTPBasicAuth
url = "https://dev.azure.com/{organization}/{project}/_apis/build/builds?definitionId={id}&api-version=6.0"
But it gives me ##[error]Parameter 'toolPath' cannot be null or empty
Upvotes: 1
Views: 5088
Reputation: 41
Asking for toolPath as said by @msanford is for python Interpretor.
# Run a Python file or inline script
- task: PythonScript@0
inputs:
#scriptSource: 'filePath' # Options: filePath, inline
#scriptPath: # Required when scriptSource == filePath
#script: # Required when scriptSource == inline
#arguments: # Optional
#pythonInterpreter: # Optional
#workingDirectory: # Optional
#failOnStderr: false # Optional
You can follow above syntax and provide pythonInterpreter: /usr/bin/python3
, however path might be different.
To get exact path run your task in Bask@3
and execute any random python3 command in script for example python3 -m import sys
it will show you error with complete interpreter path and use that one.
Upvotes: 3