How to send a var to stdin of an external software
Marko Rauhamaa
marko at pacujo.net
Thu Mar 13 08:03:51 EDT 2008
Benjamin Watine <watine at cines.fr>:
> How can I do this ? I would like a function like that :
>
> theFunction ('cat -', stdin=myVar)
>
> Another related question : Is there's a limitation of var size ? I
> would have var up to 10 MB.
import subprocess
myVar = '*' * 10000000
cat = subprocess.Popen('cat',shell = True,stdin = subprocess.PIPE)
cat.stdin.write(myVar)
cat.stdin.close()
cat.wait()
Marko
--
Marko Rauhamaa mailto:marko at pacujo.net http://pacujo.net/marko/
More information about the Python-list
mailing list