0

At the moment the code I have is

print ("Getting MediaInfo...")
mediainfo_command = ("mediainfo", input_file_full)
mediainfo = (subprocess.call(mediainfo_command))

So what I want to do is save the output of the subprocess.call into the variable mediainfo. But I don't want to display the actual output of the command in the terminal.

Is this possible?

4

2 回答 2

1

改用 subprocess.Popen.communicate 。

print ("Getting MediaInfo...")
mediainfo_command = ["mediainfo", input_file_full]
proc = subprocess.Popen(mediainfo_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
mediainfo, mediaerr = proc.communicate()
于 2013-10-03T22:02:56.827 回答
0

你可能还想看看subprocess.check_output

print ("Getting MediaInfo...")
mediainfo_command = ["mediainfo", input_file_full]
mediainfo = subprocess.check_output(mediainfo_command)
于 2013-10-03T22:09:25.523 回答