2

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

2
  • Have you tried providing a toolPath, perhaps pointing to a python interpreter? Commented Nov 8, 2021 at 16:04
  • 1
    since , python interpreter is optional argument haven't tried passing it. how do we provide the toolpath? Commented Nov 8, 2021 at 17:02

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

This worked for me when running the pipeline on a self hosted machine which threw the same error. Thank you very much!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.