Search code examples
pythonpython-3.xamazon-web-servicesamazon-polly

'Polly' object has no attribute 'start_speech_synthesis_task'


I am trying to use StartSpeechSynthesisTask of AWS Polly with this code:

client = boto3.client('polly')
response = client.start_speech_synthesis_task(
            OutputFormat= "mp3",
            Text = text,
            TextType = "ssml",
            VoiceId= VOICE, 
            OutputS3BucketName=BUCKET,
            OutputS3KeyPrefix=filename)

However, it throws this error:

'Polly' object has no attribute 'start_speech_synthesis_task'

I instantiated the client also with boto3.Session(...).client(...) – same error.

I tried updating boto3 to no avail. A similar post in the AWS forums seems unanswered.

How can I fix this?

Thanks in advance!


Solution

  • Solved it. I have to instantiate with region_name:

    client = boto3.Session(region_name='eu-west-2').client('polly')