PR: Catching pydub's warning of ffmpeg or avconv missing
This commit is contained in:
parent
81e3f24acd
commit
b7f5662ffd
1 changed files with 7 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ import tempfile
|
|||
import traceback
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
from urllib.parse import parse_qs, quote, unquote, urlparse, urlunparse
|
||||
from warnings import catch_warnings
|
||||
|
||||
import mammoth
|
||||
import markdownify
|
||||
|
|
@ -29,7 +30,12 @@ from bs4 import BeautifulSoup
|
|||
|
||||
# Optional Transcription support
|
||||
try:
|
||||
import pydub
|
||||
# Using warnings' catch_warnings to catch
|
||||
# pydub's warning of ffmpeg or avconv missing
|
||||
with catch_warnings(record=True) as w:
|
||||
import pydub
|
||||
if w:
|
||||
raise ModuleNotFoundError
|
||||
import speech_recognition as sr
|
||||
|
||||
IS_AUDIO_TRANSCRIPTION_CAPABLE = True
|
||||
|
|
|
|||
Loading…
Reference in a new issue