alphacep / vosk-api

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Apache License 2.0
7.38k stars 1.04k forks source link

Executing "python test_simple.py test.wav" reports an SSL error #1445

Closed wei-gen closed 9 months ago

wei-gen commented 9 months ago

Error message: `PS D:\vosk\vosk-api-master\python\example> python test_simple.py test.wav urllib3.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:1123)

The above exception was the direct cause of the following exception:

urllib3.exceptions.ProxyError: ('Unable to connect to proxy', SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)')))

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\luo\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen( File "C:\Users\luo\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen retries = retries.increment( File "C:\Users\luo\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\retry.py", line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='alphacephei.com', port=443): Max retries exceeded with url: /vosk/models/model-list.json (Caused by ProxyError('Unable to connect to proxy', SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)'))))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\vosk\vosk-api-master\python\example\test_simple.py", line 16, in model = Model(lang="en-us") File "C:\Users\luo\AppData\Local\Programs\Python\Python39\lib\site-packages\vosk__init.py", line 54, in init model_path = self.get_model_path(model_name, lang) File "C:\Users\luo\AppData\Local\Programs\Python\Python39\lib\site-packages\vosk__init.py", line 67, in get_model_path model_path = self.get_model_by_lang(lang) File "C:\Users\luo\AppData\Local\Programs\Python\Python39\lib\site-packages\vosk\init__.py", line 98, in get_model_by_lang response = requests.get(MODEL_LIST_URL, timeout=10) File "C:\Users\luo\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 73, in get return request("get", url, params=params, kwargs) File "C:\Users\luo\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 59, in request return session.request(method=method, url=url, kwargs) File "C:\Users\luo\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 589, in request resp = self.send(prep, send_kwargs) File "C:\Users\luo\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 703, in send r = adapter.send(request, kwargs) File "C:\Users\luo\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 513, in send raise ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPSConnectionPool(host='alphacephei.com', port=443): Max retries exceeded with url: /vosk/models/model-list.json (Caused by ProxyError('Unable to connect to proxy', SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1123)')))) Exception ignored in: <function Model.del at 0x000001F4AF44ECA0> Traceback (most recent call last): File "C:\Users\luo\AppData\Local\Programs\Python\Python39\lib\site-packages\vosk\init.py", line 60, in del__ AttributeError: 'Model' object has no attribute '_handle'`

nshmyrev commented 9 months ago

Some old Windows installations might have problems with certificates. Please download the model manually and specify model_path instead of model_name

nshmyrev commented 9 months ago

Similar to https://github.com/alphacep/vosk-api/issues/1015

wei-gen commented 9 months ago

Thank you for your answer, it helped me solve the problem.

nshmyrev commented 9 months ago

Ok, let us know how it goes

wei-gen commented 9 months ago

After I installed ffmpeg according to your answer, I can run the python example normally.