Created
August 1, 2017 10:28
-
-
Save kstohr/26cf1d389c689d11433bd560b42df0a1 to your computer and use it in GitHub Desktop.
Python subprocess to run a CLI python script in interactive mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import Popen, PIPE | |
cmd = 'python some_python_script.py' | |
p = subprocess.Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) | |
stdout, stderr = p.communicate() | |
stdout.splitlines() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment