Problem
As the title says, I am trying to run sphinx-apidoc
from subprocess.run()
on Ubuntu 20.04 in Azure DevOps Build Pipeline.
My problem is that I seem to get an error but no message and nothing is really executed?
My code is
call = ['sphinx-apidoc']
try:
res = subprocess.run(call, text=True, check=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
print(res)
print("stdout: ", res.stdout)
print("stderr: ", res.stderr)
except subprocess.CalledProcessError as e:
print("CalledProcessError: " + e.output)
and my output is
CalledProcessError:
without any output.
What I tried
I can invoke sphinx-apidoc
using a pipeline step
task: CmdLine@2
And I can also call for example python --version
using the above subprocess.run(), using
call= ['python']
call.append('--version')
- Why is it that I do not get an output from an error?
- Why is it not working although other commands like running python works?
- why can I execute the command from a pipeline step without a problem?
Update - Task Definitions
For the test command, I just use this:
- task: CmdLine@2
inputs:
script: |
sphinx-apidoc *putfolder *source
for my python script that should run Subprocess.run()
Python3.9.15
- task: PythonScript@0
inputs:
scriptSource: 'filePath'
scriptPath: '$(System.DefaultWorkingDirectory)/myScript.py'
p.s. I know that only calling sphinx-apidoc without arguments will lead to an error, this is just for the sake of simplicity. And it should still give me a proper error message, so I know the subprocess was run properly.