aws-robotics / tts-ros1

ROS packages for facilitating text-to-speech and the use of Amazon Polly.
Apache License 2.0
19 stars 14 forks source link

'AWSHTTPSConnection' object has no attribute 'server_hostname #13

Closed mjsobrep closed 5 years ago

mjsobrep commented 5 years ago

I am having problems getting the tts-ros1 code to work. I have permissions setup through the aws-cli and can do something like: aws polly synthesize-speech --output-format mp3 --voice-id Ivy --text 'hello, this is a test' test.mp3 which will work. I can also run the demo from the polly docs without any problem.

Running in kinetic, I have made my own config file to have the region as "us-east-1" and have modified the sample launch file to use the new config file.

I then run the launch file and get logging info that the synthesizer is running, polly is running, sound play is running. I send in a command using the voicer.py, I get some info about the text that was received, that it will use Polly, the request. And then the actual request which will be sent to aws:

Node: /polly_node Time: 12:14:10.334841966 (2019-05-22) Severity: Info Published Topics: /rosout

Amazon Polly Request: {'OutputFormat': 'ogg_vorbis', 'SpeechMarkTypes': [], 'VoiceId': 'Joanna', 'Text': 'hello', 'LexiconNames': [], 'SampleRate': '22050', 'TextType': 'text'}

Location: amazonpolly.py:_synthesize_speech_and_save:295


But then the request fails to return properly and I get this error:

Node: /polly_node Time: 12:14:10.472778081 (2019-05-22) Severity: Error Published Topics: /rosout

{"Audio Type": "ogg", "Audio File": "/opt/ros/kinetic/lib/python2.7/dist-packages/tts/data/error.ogg", "Traceback": "Traceback (most recent call last):\n File \"/opt/ros/kinetic/lib/python2.7/dist-packages/tts/amazonpolly.py\", line 352, in _node_request_handler\n response = self._dispatch(request)\n File \"/opt/ros/kinetic/lib/python2.7/dist-packages/tts/amazonpolly.py\", line 339, in _dispatch\n return actionsrequest.polly_action\n File \"/opt/ros/kinetic/lib/python2.7/dist-packages/tts/amazonpolly.py\", line 296, in _synthesize_speech_and_save\n response = self.polly.synthesize_speech(kws)\n File \"/usr/lib/python2.7/dist-packages/botocore/client.py\", line 251, in _api_call\n return self._make_api_call(operation_name, kwargs)\n File \"/usr/lib/python2.7/dist-packages/botocore/client.py\", line 526, in _make_api_call\n operation_model, request_dict)\n File \"/usr/lib/python2.7/dist-packages/botocore/endpoint.py\", line 141, in make_request\n return self._send_request(request_dict, operation_model)\n File \"/usr/lib/python2.7/dist-packages/botocore/endpoint.py\", line 170, in _send_request\n success_response, exception):\n File \"/usr/lib/python2.7/dist-packages/botocore/endpoint.py\", line 249, in _needs_retry\n caught_exception=caught_exception, request_dict=request_dict)\n File \"/usr/lib/python2.7/dist-packages/botocore/hooks.py\", line 227, in emit\n return self._emit(event_name, kwargs)\n File \"/usr/lib/python2.7/dist-packages/botocore/hooks.py\", line 210, in _emit\n response = handler(kwargs)\n File \"/usr/lib/python2.7/dist-packages/botocore/retryhandler.py\", line 183, in call\n if self._checker(attempts, response, caught_exception):\n File \"/usr/lib/python2.7/dist-packages/botocore/retryhandler.py\", line 251, in call\n caught_exception)\n File \"/usr/lib/python2.7/dist-packages/botocore/retryhandler.py\", line 269, in _should_retry\n return self._checker(attempt_number, response, caught_exception)\n File \"/usr/lib/python2.7/dist-packages/botocore/retryhandler.py\", line 317, in call\n caught_exception)\n File \"/usr/lib/python2.7/dist-packages/botocore/retryhandler.py\", line 223, in call\n attempt_number, caught_exception)\n File \"/usr/lib/python2.7/dist-packages/botocore/retryhandler.py\", line 359, in _check_caught_exception\n raise caught_exception\nAttributeError: 'AWSHTTPSConnection' object has no attribute 'server_hostname'\n", "Exception": {"Value": "'AWSHTTPSConnection' object has no attribute 'server_hostname'", "Type": "<type 'exceptions.AttributeError'>", "Name": "AttributeError", "Module": "exceptions"}}

Location: amazonpolly.py:_node_request_handler:376


Any thoughts on what I am doing wrong?

timrobotson commented 5 years ago

It seems like your boto3 package may be out of date. Could you try running pip3 install -U boto3 and see if that resolves the issue.

Does the following work for you after starting the nodes?

rosservice call /polly SynthesizeSpeech 'hello polly' '' '' '' '' '' '' '' '' [] [] 0 '' '' '' '' '' '' false
mjsobrep commented 5 years ago

Cool, that seemed to solve the problem. I did get a warning when installing that it might cause some problems with breaking compatibility with the aws-cli, but I am not having any problems.

Yes, after escaping the [ and ], the service call now works too.

Thanks for the help