how to change azure devops script execution path

505 Views Asked by At

Is there a way to avoid executing a python script in the temp directory? I mean, even though I set the working directory to be the repository on which I want to execute my python script I cannot manage to tell Azure DevOps to run the script on my actual working directory, which is my repostory.$(Build.Repository.LocalPath).

All of this because I use a python script that is configured on my pipeline and that uses some modules from my repository, and when importing the modules, an ImportError: No module named my_module error ocurres.

Here's what I'm referring to.

C:\python27\python.exe C:\agent\my_agent\_work\_temp\ec6523f-efsd....py As you can see on the output from Azure DevOps, the script from my pipeline is executing on the _temp directory on which there are no modules to import and the error comes out.

1

There are 1 best solutions below

4
On

i was using script step (not python script step) and it was working fine for me (and it was using imports:

steps:
- bash: python3 path/to/my/script_in_the_repo.py xxx yyy