diff --git a/pymkv/MKVFile.py b/pymkv/MKVFile.py index ea581f0..afc234c 100644 --- a/pymkv/MKVFile.py +++ b/pymkv/MKVFile.py @@ -260,11 +260,11 @@ def mux(self, output_path, silent=False): 'property') output_path = expanduser(output_path) if silent: - sp.run(self.command(output_path, subprocess=True), stdout=open(devnull, 'wb')) + sp.run(self.command(output_path, subprocess=True), stdout=open(devnull, 'wb'), check=True) else: command = self.command(output_path) print('Running with command:\n"' + command + '"') - sp.run(self.command(output_path, subprocess=True)) + sp.run(self.command(output_path, subprocess=True), check=True, capture_output=True) def add_file(self, file): """Add an MKV file into the :class:`~pymkv.MKVFile` object. diff --git a/pymkv/Verifications.py b/pymkv/Verifications.py index 9a7fe27..ad74270 100644 --- a/pymkv/Verifications.py +++ b/pymkv/Verifications.py @@ -4,6 +4,7 @@ """Verification functions for mkvmerge and associated files.""" import json +import os from os.path import expanduser, isfile from re import match import subprocess as sp @@ -25,7 +26,7 @@ def verify_mkvmerge(mkvmerge_path='mkvmerge'): def verify_matroska(file_path, mkvmerge_path='mkvmerge'): - """Verify a file is a Matroska file. + """Verify if a file is a Matroska file. file_path (str): Path of the file to be verified. @@ -35,7 +36,9 @@ def verify_matroska(file_path, mkvmerge_path='mkvmerge'): if not verify_mkvmerge(mkvmerge_path=mkvmerge_path): raise FileNotFoundError('mkvmerge is not at the specified path, add it there or change the mkvmerge_path ' 'property') - if not isinstance(file_path, str): + if isinstance(file_path, os.PathLike): + file_path = str(file_path) + elif not isinstance(file_path, str): raise TypeError('"{}" is not of type str'.format(file_path)) file_path = expanduser(file_path) if not isfile(file_path):