1

This is the code:

try:
    s = check_output(['mediainfo', '--Inform=General;%Format%', filename])  # Gets the output from mediainfo

When running it, I get

subprocess.CalledProcessError: Command '['mediainfo', '--Inform=General;%Format%', 'xyz']' returned non-zero exit status 1

When running mediainfo --Inform='Video;%Format%' s03e07.mkv in a terminal, I get the desired output though, so what's going on here?

user2765654
  • 160
  • 6

1 Answers1

1

There is nothing wrong with the first two arguments. there are two strong possibilities, you are reading from a file and you have trailing whitespace on the filename:

"sample.mkv\n"

Or you current working directory is not where the file is so you need to pass the full path or set cwd="path_to_filr_dir" in check_output call.

Padraic Cunningham
  • 176,452
  • 29
  • 245
  • 321
  • So how would I have to modify this part? s = check_output(['mediainfo', '--Inform=General;%Format%', filename]) I already tried replacing filename with "filename\n" but that didn't help. – user2765654 Jul 11 '16 at 17:51
  • Wherever the file is set you cwd, `check_output(['mediainfo', '--Inform=General;%Format%', filename], cwd="path_to_file_dir") ` – Padraic Cunningham Jul 11 '16 at 18:01