I'm trying to get my pipeline to run a Python script. The script is in the same directory as the yml file, so I think this is the way to do it:
- task: PythonScript@0
inputs:
scriptSource: 'filePath'
scriptPath: '$(System.DefaultWorkingDirectory)/myTestPythonFile.py'
The yml
file and the python file are in the same folder
However, upon running the pipeline, I run into the following error: ##[error]ENOENT: no such file or directory
What am I doing wrong?
I can reproduce your error with your yaml.
The command git checkout -b DIN_grafana_json_archives --track origin/DIN_grafana_json_archives
will create a new local branch DIN_grafana_json_archives
and switch to it, it's tracking the remote branch. You can check the link for the command behavior details.
After the command, the working directory content is from the new branch, not the self branch. And in your new branch, there is no target python file, which will cause the error.
In addition, to make sure the directory content, you can add bash task to list the files in the working directory before pythonscript
task for a check.
- bash: |
find . -type f
displayName: checkout file list
- task: PythonScript@0
....