I've been trying to get started with the StartTranscriptionJob with AWS and I'm receiving a "An error occurred (400) when calling the StartTranscriptionJob operation:" But not further details.

This is the only response I'm getting:

botocore.exceptions.ClientError: An error occurred (400) when calling the StartTranscriptionJob operation: 

Here's my code (copy/paste from AWS documentation)

`
`def transcribe_file(job_name, file_uri, transcribe_client):
    # Try Except
    try: 
        transcribe_client.start_transcription_job(
            TranscriptionJobName = job_name,
            Media = {
                'MediaFileUri': file_uri
            },
            MediaFormat = 'mp3',
            LanguageCode = 'en-US'
        )
    except botocore.exceptions.ClientError as e:
            if e.response['Error']['Code'] in error_list:
                print("Yes, error is in list")
            raise e

    max_tries = 60
    while max_tries > 0:
        max_tries -= 1
        try: 
            job = transcribe_client.get_transcription_job(TranscriptionJobName = job_name)
        except botocore.exceptions.ClientError as e:
            raise e
        job_status = job['TranscriptionJob']['TranscriptionJobStatus']
        if job_status in ['COMPLETED', 'FAILED']:
            print(f"Job {job_name} is {job_status}.")
            if job_status == 'COMPLETED':
                print(
                    f"Download the transcript from\n"
                    f"\t{job['TranscriptionJob']['Transcript']['TranscriptFileUri']}.")
            break
        else:
            print(f"Waiting for {job_name}. Current status is {job_status}.")
        time.sleep(10)


def main():
    transcribe_client = boto3.client('transcribe', region_name = 'us-east-1')
    file_uri = 's3://alpe-files/lessons/the convergence of crypto and ai.mp3'
    transcribe_file('convergenceAI', file_uri, transcribe_client)


if __name__ == '__main__':
    main()`
`

I've:

  1. Verifying that I haver permissions to the S3 bucket where the item is stored
  2. Updated Boto3 to latest version
  3. Tried to debug using boto3 error handing (unsuccessfuly)
0

There are 0 best solutions below