Skip to content

Commit

Permalink
Merge pull request #475 from GreyAlien502/python3-errors
Browse files Browse the repository at this point in the history
show ffmpeg errors legibly in Python 3
  • Loading branch information
GreyAlien502 committed May 21, 2020
2 parents a2999f7 + dc86481 commit 20044bc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pydub/audio_segment.py
Expand Up @@ -602,7 +602,7 @@ def is_format(f):
if p.returncode != 0:
raise CouldntDecodeError(
"Decoding failed. ffmpeg returned error code: {0}\n\nOutput from ffmpeg/avlib:\n\n{1}".format(
p.returncode, p_err))
p.returncode, p_err.decode(errors='ignore') ))
obj = cls._from_safe_wav(output)
finally:
input_file.close()
Expand Down Expand Up @@ -722,7 +722,7 @@ def is_format(f):
file.close()
raise CouldntDecodeError(
"Decoding failed. ffmpeg returned error code: {0}\n\nOutput from ffmpeg/avlib:\n\n{1}".format(
p.returncode, p_err))
p.returncode, p_err.decode(errors='ignore') ))

p_out = bytearray(p_out)
fix_wav_headers(p_out)
Expand Down Expand Up @@ -910,7 +910,7 @@ def export(self, out_f=None, format='mp3', codec=None, bitrate=None, parameters=
if p.returncode != 0:
raise CouldntEncodeError(
"Encoding failed. ffmpeg/avlib returned error code: {0}\n\nCommand:{1}\n\nOutput from ffmpeg/avlib:\n\n{2}".format(
p.returncode, conversion_command, p_err))
p.returncode, conversion_command, p_err.decode(errors='ignore') ))

output.seek(0)
out_f.write(output.read())
Expand Down

0 comments on commit 20044bc

Please sign in to comment.