awslabs / amazon-transcribe-streaming-sdk

The Amazon Transcribe Streaming SDK is an async Python SDK for converting audio into text via Amazon Transcribe.
Apache License 2.0
140 stars 38 forks source link

Future Cancelled Error #61

Open parikls opened 2 years ago

parikls commented 2 years ago

Eventually during real-time transcription i'm receiving next error:

InvalidStateError: CANCELLED: <Future at 0x7f562153e2b0 state=cancelled>
  File "awscrt/http.py", line 243, in _on_body
    self._on_body_cb(http_stream=self, chunk=chunk)
  File "amazon_transcribe/httpsession.py", line 99, in _on_body
    future.set_result(chunk)
  File "concurrent/futures/_base.py", line 533, in set_result
    raise InvalidStateError('{}: {!r}'.format(self._state, self))

That's actually the full stack-trace so i assume this is being ran in a separate thread (?) and the error is not being propagated. I even can't handle it actually

SamComber commented 4 months ago

await self.stream.input_stream.end_stream() seemed to fix this for me if anyone else is having issue!