#write operation error

1 messages · Page 1 of 1 (latest)

wooden briar
#

Hi, i am trying to transcribe some files and have been encountering a write operation time out error. I've looked for anything pertaining but can't seem to find why this is happening. I dont have a response_id because its not executing. This code ran fine 2 days ago so idk,
The code I am using is

'''
try:
print('go')
# Assuming DeepgramClient and related objects are properly defined
deepgram = DeepgramClient(DEEPGRAM_API_KEY)

    with open(audio_url, "rb") as file:
        buffer_data = file.read()

    payload: FileSource = {
        "buffer": buffer_data,
    }

    options = PrerecordedOptions(
        model="nova-2",
        smart_format=True,
    )  
    print('calling')
    response = deepgram.listen.prerecorded.v("1").transcribe_file(payload, options)
    print('response aqcuired')
    # Generate a filename with a timestamp
    timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
    filename = f"/Users/uflo/Documents/uflo/new_els/transcription_result_{timestamp}.json"

    # Save the JSON response to a file
    with open(filename, 'w') as json_file:
        json.dump(response.to_json(), json_file, indent=4)

    print(f"Transcription saved to {filename}")

except Exception as e:
    print(f"Exception type: {e.__class__.__name__}, Message: {e}")
broken turtleBOT
#

Thanks for asking your question. Please be sure to reply with as much detail as possible so we can assist you efficiently. Such as:

  • Provide the request_id if you've a question about a transcription response.
  • The options you used or the api.deepgram.com URL you sent your request to, including parameters.
  • Any code snippets you can include.
  • Any audio you can include, or if you can't share it here please email it to us at [email protected] and provide a link to this thread.
chilly wren
#

hi @wooden briar how large is the file? and how long is the audio? it's possible you were right on the edge of the timeout

wooden briar
#

@chilly wren its 3 hours 7 minutes. 178 MB. Do i need to extend the timeout?

chilly wren
#

If it was working before, it's right on the border then. Definitely sounds like you are squeaking by. The size isn't bad, but the length of the audio probably... Especially combined with how chatty it is in words with what options.

#

I think the default is 30.
timeout = httpx.Timeout(30.0, connect=10.0) just need bump this up

chilly wren
#

got this to work? if you still need help with this, tag me back here