首页 > 解决方案 > 收到错误:[SSL: BAD_LENGTH] 长度错误 (_ssl.c:2408)

问题描述

我做了一个可以用语音命令控制的游戏。要将所有语音命令转换为文本,我使用了 IBM Cloud Speech to Text 服务。一切都完成了,只是它向我显示了 BAD LENGTH ERROR,正如您在图像中看到的那样。 在此处输入图像描述

这是语音到文本的代码:

###############################################
#### Initalize queue to store the recordings ##
###############################################
CHUNK = 1024
# Note: It will discard if the websocket client can't consumme fast enough
# So, increase the max size as per your choice
BUF_MAX_SIZE = CHUNK * 10
# Buffer to store audio
q = Queue(maxsize=int(round(BUF_MAX_SIZE / CHUNK)))

# Create an instance of AudioSource
audio_source = AudioSource(q, True, True)

###############################################
#### Prepare Speech to Text Service ########
###############################################

# initialize speech to text service
authenticator = IAMAuthenticator('i3gkxvESZRUHnt0_Iv2PtMQaHd2roF1YgvTTIzq0tbop')
speech_to_text = SpeechToTextV1(authenticator=authenticator)
speech_to_text.set_service_url("https://api.eu-gb.speech-to- 
text.watson.cloud.ibm.com/instances/54f44656-b15c-4a16-8dac-c5b782482f93")

actions = []

标签: sslopensslruntime-erroribm-cloudsignals-slots

解决方案


通过卸载所有软件包并重新安装所需的软件包,我解决了该错误。它只会成功运行,即使您将来收到该错误,请再次尝试执行此过程。它会起作用的。除此之外,我找不到任何其他解决方案。


推荐阅读