'Python task in azure
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
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Rahul Singh |