btarent.blogg.se

Python run subprocess in background
Python run subprocess in background













Maybe this will point you in the right direction or at least make you aware of the subprocess module if you haven't heard of it. Here is a snippet taken from one of the examples where you can write to the stdin of the spawned process (you can do something similar for reading from stdout as well):Ĭode: Select all proc = subprocess.Popen(, stdin=subprocess.PIPE) It covers writing to and reading from stdin and stdout of a subprocess: This is the Python 2.7 documentation for the subprocess module: Īnd I think this site has a great writeup with some examples on using the module. You can spawn a new process from Python 2.7 code (to run your Python 3 script) and set it up such that the stdin and stdout can be read and written to.

python run subprocess in background

I don't have any of my own examples I can provide, but are you familiar with the subprocess module in Python? It sounds like that may be what you want.















Python run subprocess in background