简体   繁体   中英

How to run step-cli using subprocess.run() in python

I am on Windows and installed the step on Windows. It was installed successfully.

step certificate inspect https://smallstep.com

When I run this, it was confirmed.

But when I run the bellow code in python, it raised an error.

result = subprocess.run(['step', 'ca', 'certificate', '--ca-url=https://x.x.x.x', email, crt, key, '--root=root.crt', '--provisioner-password-file=provision.txt'])

Here is the error:

FileNotFoundError: [WinError 2] The system cannot find the file specified

But the file path is correct. I am sure it.

Are you sure you import the subprocess?

import subprocess

You could test if the subprocess runs correctly.

result = subprocess.run([sys.executable, "-c", "print('ocean')"])

If this runs well. it will says like 'ocean'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM