python 文本转语音播放失败_python - 文本语音Raspberry pi错误-gtts.tts.gTTSError:令牌计算期间的连接错误 - 堆栈内存溢出...

在Raspberry Pi 3上使用Python的gTTS库将questions.txt文件中的文本转换为语音时遇到错误。代码在保存音频时返回gTTSError,详细错误信息为HTTPSConnectionPool的Max retries exceeded和SSLError,原因可能是证书验证失败。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我正在编写代码,将Raspberry Pi 3上的“ questions.txt”文件中的某些英语行通过google text-to-speech转换为语音。我正在使用Python的gTTS库执行上述操作。 但是我的代码返回以下错误

Starting Conversion

Traceback (most recent call last):

File "tts.py", line 21, in

getAudioQues()

File "tts.py", line 16, in getAudioQues

myobj.save("../data/quesAudio/"+str(quesNo)+".mp3")

File "/home/pi/.local/lib/python2.7/site-packages/gtts/tts.py", line 247, in save

self.write_to_fp(f)

File "/home/pi/.local/lib/python2.7/site-packages/gtts/tts.py", line 192, in write_to_fp

str(e))

gtts.tts.gTTSError: Connection error during token calculation: HTTPSConnectionPool(host='translate.google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', &#

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值