whitphx / streamlit-webrtc

Real-time video and audio streams over the network, with Streamlit.
https://discuss.streamlit.io/t/new-component-streamlit-webrtc-a-new-way-to-deal-with-real-time-media-streams/8669
MIT License
1.34k stars 181 forks source link

AttributeError: 'builtins.Certificate' object has no attribute '_x509' #1164

Closed jp1924 closed 1 year ago

jp1924 commented 1 year ago

environment

Hi! I am using your webrtc very well! Thank you for making it!

when i running the streamlit-stt-app you posted, and there was an error as below

unnamed

so i checked the manage app, and error like below

Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.py", line 554, in _run_script
    exec(code, module.__dict__)
  File "app_deepspeech.py", line 275, in <module>
    main()
  File "app_deepspeech.py", line 101, in main
    app_sst(str(MODEL_LOCAL_PATH), str(LANG_MODEL_LOCAL_PATH), lm_alpha, lm_beta, beam)
  File "app_deepspeech.py", line 107, in app_sst
    webrtc_ctx = webrtc_streamer(
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit_webrtc/component.py", line 589, in webrtc_streamer
    webrtc_worker.process_offer(sdp_offer["sdp"], sdp_offer["type"])
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit_webrtc/webrtc.py", line 583, in process_offer
    raise result
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit_webrtc/webrtc.py", line 225, in _process_offer_coro
    await pc.setRemoteDescription(offer)
  File "/home/appuser/venv/lib/python3.9/site-packages/aiortc/rtcpeerconnection.py", line 828, in setRemoteDescription
    transceiver = self.__createTransceiver(
  File "/home/appuser/venv/lib/python3.9/site-packages/aiortc/rtcpeerconnection.py", line 1067, in __createTransceiver
    dtlsTransport = self.__createDtlsTransport()
  File "/home/appuser/venv/lib/python3.9/site-packages/aiortc/rtcpeerconnection.py", line 1044, in __createDtlsTransport
    dtlsTransport = RTCDtlsTransport(iceTransport, self.__certificates)
  File "/home/appuser/venv/lib/python3.9/site-packages/aiortc/rtcdtlstransport.py", line 375, in __init__
    self.__ctx = certificate._create_ssl_context()
  File "/home/appuser/venv/lib/python3.9/site-packages/aiortc/rtcdtlstransport.py", line 211, in _create_ssl_context
    _openssl_assert(lib.SSL_CTX_use_certificate(ctx, self._cert._x509) == 1)  # type: ignore
AttributeError: 'builtins.Certificate' object has no attribute '_x509'

i check this and found the same error at aiortc issue #804 this error occurs when Cryptography version over 39.0.0

so to solve this problem, I want you to change it to install only the version below cryptography. thank you

whitphx commented 1 year ago

Thank you for the report and kind guide! This should be fixed with the next release, so please check it. Thanks!