From 58ac6288965c57e4531e3aedfd7b9e1be7760301 Mon Sep 17 00:00:00 2001 From: giovcandido Date: Fri, 17 Sep 2021 12:18:19 -0300 Subject: [PATCH] Check if there is a warning before handling it --- sedona/Converter.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sedona/Converter.py b/sedona/Converter.py index e165e81..8e9dd19 100644 --- a/sedona/Converter.py +++ b/sedona/Converter.py @@ -5,12 +5,13 @@ with catch_warnings(record=True) as w: from pydub import AudioSegment - warning_message = str(w[-1].message) + if bool(w): + warning_message = str(w[-1].message) - if 'ffmpeg' in warning_message and 'avconv' in warning_message: - print('[Warning] You need to install ffmpeg package in your system.') - print('For more information, check our repository:') - print('https://github.com/giovcandido/sedona') + if 'ffmpeg' in warning_message and 'avconv' in warning_message: + print('[Warning] You need to install ffmpeg package in your system.') + print('For more information, check our repository:') + print('https://github.com/giovcandido/sedona') from os import path, mkdir