TVK
TVK

Reputation: 1150

SSL not available in watson-developer-cloud example microphone-speech-to-text.py

Hello i try to get the following example running:

microphone-speech-to-text

I run this python script on Gentoo Linux device with a Python 2.7.6. The device is connected to the internet via a mobile Hotspot from my mobile phone.

Unfortunately it does not work and get the following output:

Enter CTRL+C to end recording...
Error received: SSL not available.
Connection closed

I ran the script on my windows and it worked fine.

SSL libs are installed:

ldconfig -p | grep ssl
vocon_ssl.so (libc6) => /opt/aldebaran/lib/vocon_ssl.so
libssl.so.1.0.0 (libc6) => /usr/lib/libssl.so.1.0.0
libssl.so (libc6) => /usr/lib/libssl.so
libgnutls-openssl.so.27 (libc6) => /usr/lib/libgnutls-openssl.so.27
libgnutls-openssl.so (libc6) => /usr/lib/libgnutls-openssl.so
libevent_openssl-2.0.so.5 (libc6) => /usr/lib/libevent_openssl-2.0.so.5

If i run another example (speech_to_text_v1) I get the correct result from watson followed by:

Error received: SSL not available.

Does anybody have an idea what could be the issue here?

Thanks

Upvotes: 1

Views: 174

Answers (2)

TVK
TVK

Reputation: 1150

I could get rid of the "SSL not available" error by

pip install backports.ssl-match-hostname

I got this hint from here.

Also here is mentioned that websocket_client depends on backports.ssl-match-hostname for Python 2.x

After installing the package i got:

Error received: _ssl.c:334: No root certificates specified for verification of other-side certificates.

This could be fixed temporarily by calling disable_SSL_verification() of SpeechToTextV1 before the processing.

To fix it in the long term an approach could be downgrading the websocket-client library to 0.47.0 link1 link2

Another approach to get rid of the "No root certificates specified" Error is setting the Environment variable WEBSOCKET_CLIENT_CA_BUNDLE that is checked by the websocket library. e.g.

os.environ['WEBSOCKET_CLIENT_CA_BUNDLE'] = '/etc/ssl/certs/ca-certificates.crt'

Upvotes: 2

chughts
chughts

Reputation: 4747

If I were to hazard a guess it would be that your Gentoo Linux device hasn't been setup with the appropriate TLS / SSL libraries. As a test run a list models request through cURL on your device, as per the API documentation - https://cloud.ibm.com/apidocs/speech-to-text#list-models

curl -X GET -u "apikey:{apikey}" "https://stream.watsonplatform.net/speech-to-text/api/v1/models"

That is going over TLS so, if you can get that to work, you may have better luck with the python application.

Upvotes: 0

Related Questions