GithubHelp home page GithubHelp logo

calling sync_prerecorded fails with ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2396) about deepgram-python-sdk HOT 8 CLOSED

deepgram avatar deepgram commented on September 20, 2024
calling sync_prerecorded fails with ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2396)

from deepgram-python-sdk.

Comments (8)

RodrigoCR avatar RodrigoCR commented on September 20, 2024 1

This is happening to me too in Macos Ventura 13.4.1 (c) (22F770820d)
The weird thing is the first time I ran the example, everything went well. Now that I wanted to re run it, I'm receiving this error.

from deepgram-python-sdk.

mabdelfattah avatar mabdelfattah commented on September 20, 2024

Were you using Docker? If so, which image were you using?

from deepgram-python-sdk.

diegoph avatar diegoph commented on September 20, 2024

It happens here sometimes too. Linux mint 20.

Edit: Using it asynchronously worked without any problems.

response = await dg_client.transcription.prerecorded(source, options)

from deepgram-python-sdk.

peldszus avatar peldszus commented on September 20, 2024

I got the same error (Ubuntu, Python 3.11).

A quick way to reproduce this is to send a prerecorded request to a whisper model with the keywords=Whisper parameter. Because the whisper models (veeeeeeeheeeery unfortunately ;)) do not support the keywords feature, the API will return a 400:

{
	"err_code": "INVALID_QUERY_PARAMETER",
	"err_msg": "When using Whisper, keywords are not available.",
	"request_id": "..."
}

When you do this async with response = await dg_client.transcription.prerecorded(source, options), an exception is raised that at least hints you into the right direction, even if it doesn't convey the more informative err_msg:

Traceback (most recent call last):
...
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://api.deepgram.com/v1/listen?model=whisper-medium&keywords=Whisper')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
...
Exception: DG: 400, message='Bad Request', url=URL('https://api.deepgram.com/v1/listen?model=whisper-medium&keywords=Whisper')

However, when you do this sync with response = dg_client.transcription.sync_prerecorded(source, options), the quite misleading exception shown below is raised:

Traceback (most recent call last):
...
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2423)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
...
urllib.error.URLError: <urlopen error EOF occurred in violation of protocol (_ssl.c:2423)>

The expected result would be that the same thing happens for the client user when hitting a 400, whether the call was made async or sync.

Also I'd like to add two personal preferences:

  1. I would prefer it if there was an option to return the error response instead of raising an exception, so that I can check the status code and a potential error message of the response on my own.
  2. The client library doesn't implement its own exception classes here, but instead raises the most basic Exception class with a more or less cryptic message: raise (Exception(f'DG: {exc}') if exc.status < 500 else exc). For convenient error handling in downstream applications, most client libraries implement custom exceptions, with well differentiated and speaking class names. The current implementation forces the client user to except Exception, which will (like a bare catch) subsume every possible exception that could occur. This makes error handling more complicated.

from deepgram-python-sdk.

jpvajda avatar jpvajda commented on September 20, 2024

@dvonthenen 👋

from deepgram-python-sdk.

dvonthenen avatar dvonthenen commented on September 20, 2024

Hi @shershen08

The Python SDK is going through a major overhaul right now. If you had a moment to check against the code in main branch, that would be helpful. I'm hoping at least minimally, the exception message is significantly improved. We can start with that and go from there.

from deepgram-python-sdk.

dvonthenen avatar dvonthenen commented on September 20, 2024

Hi @shershen08. The alpha.5 release is out. Can you please retry with this release and see if you run into the same problem?

from deepgram-python-sdk.

dvonthenen avatar dvonthenen commented on September 20, 2024

Closing due to inactivity. If there is still a problem with the latest release, please reopen or file a new issue. thanks!

from deepgram-python-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.