I'm creating a Lambda function in Python which is triggered by uploading an MP3 file to my S3 bucket. The function (which works on my local machine) is supposed to use pydub to create a waveform from the audio, however, I've run into an issue I don't know how to solve.
It seems I'm able to save the file to the /tmp folder, but when I try to pass the file to AudioSegment.from_file(filename), the function ends and there are no error logs in CloudWatch.
Here's the relevant block of code:
s3.download_file(bucket_name, file_key, '/tmp/temp.mp3')
src = "/tmp/temp.mp3"
try:
print 'trying...'
audio = AudioSegment.from_file(src)
except:
print 'its breaking'
print 'it worked'
I've wrapped the problem line in a try block to simplify the issue. CloudWatch simply logs:
START RequestId: 23af8832-061b-4c46-a226-6591bb972b5e Version: $LATEST
trying...
END RequestId: 23af8832-061b-4c46-a226-6591bb972b5e
Expected output would be:
START RequestId: 23af8832-061b-4c46-a226-6591bb972b5e Version: $LATEST
trying...
its breaking || it worked
END RequestId: 23af8832-061b-4c46-a226-6591bb972b5e
Am I missing something?
Any help would be greatly appreciated! :)