Python Module subprocess: Difference between revisions
Jump to navigation
Jump to search
Line 5: | Line 5: | ||
=Overview= | =Overview= | ||
=Execute an O/S Command= | =Execute an O/S Command= | ||
<syntaxhighlight lang='py'> | |||
import subprocess | |||
helm = subprocess.Popen(['helm', 'package', './my-chart'], | |||
cwd = str(Path(project_dir, 'build/helm')), | |||
stdout=subprocess.PIPE, | |||
stderr=subprocess.PIPE, | |||
universal_newlines=True) | |||
stdout, stderr = helm.communicate() | |||
print(stdout) | |||
print(stderr) | |||
</syntaxhighlight> | |||
<font color=darkkhaki>TO PROCESS: https://janakiev.com/blog/python-shell-commands/</font> |
Revision as of 21:41, 2 March 2022
External
Internal
Overview
Execute an O/S Command
import subprocess
helm = subprocess.Popen(['helm', 'package', './my-chart'],
cwd = str(Path(project_dir, 'build/helm')),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True)
stdout, stderr = helm.communicate()
print(stdout)
print(stderr)
TO PROCESS: https://janakiev.com/blog/python-shell-commands/