Я хочу вызвать script, передать содержимое строки в свой stdin и извлечь его stdout.
Я не хочу касаться реальной файловой системы, поэтому я не могу создать для нее реальные временные файлы.
используя subprocess.check_output
Я могу получить все, что пишет script; как я могу получить входную строку в свой stdin, хотя?
subprocess.check_output([script_name,"-"],stdin="this is some input")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 537, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 672, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "/usr/lib/python2.7/subprocess.py", line 1043, in _get_handles
p2cread = stdin.fileno()
AttributeError: 'str' object has no attribute 'fileno'