1

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

TVK
  • 1,042
  • 7
  • 21

2 Answers2

2

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'
TVK
  • 1,042
  • 7
  • 21
0

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.

chughts
  • 4,210
  • 2
  • 14
  • 27
  • Hi Thanks for your answer. I tried the cURL command and it actually works fine. Do you have another harzard guess? :-) I have no idea where the "SSL not available" is actually coming from. ... Btw the Gentoo is in deed old and not updated But that shouldnt be the problem i guess – TVK Mar 27 '19 at 15:37
  • In that case it might be down to a downstream python dependancy. – chughts Mar 27 '19 at 16:00
  • I dont understand What do you mean by downstream dependency? Pip libs are all installed and same version as on working windows system. Any idea how to debug, find out whats wrong? – TVK Mar 27 '19 at 16:08
  • 1
    The example you are running requires `watson_developer_cloud`, which in turn requires `requests` and `web socket-client`. `requests` requirements are complex but include `pyOpenSS`, `cryptography` and `idna`. Somewhere down the line your environment will be missing a pre-requisite. This may not be a pypi module, but something in the OS that a pypi module requires. In short I think you will not be able to run any python app that goes to a TLS address using `requests`. – chughts Mar 28 '19 at 09:56