Skip to content

Commit d040470

Browse files
Print instead of rising error when can't use pydub
1 parent 32b0553 commit d040470

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
license = "MIT"
55
name = "pyrobbot"
66
readme = "README.md"
7-
version = "0.7.1"
7+
version = "0.7.2"
88

99
[build-system]
1010
build-backend = "poetry.core.masonry.api"

pyrobbot/voice_chat.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@
3838
with contextlib.suppress(pydub.exceptions.CouldntDecodeError):
3939
AudioSegment.from_mp3(io.BytesIO())
4040
except (ImportError, OSError, FileNotFoundError) as error:
41-
logger.error(
42-
"{}. Can't use module `pydub`. Please check your system's ffmpeg install.", error
43-
)
44-
_pydub_imported = False
41+
logger.exception(error)
42+
logger.error("Can't use module `pydub`. Please check your system's ffmpeg install.")
43+
_pydub_usable = False
4544
else:
46-
_pydub_imported = True
45+
_pydub_usable = True
4746

4847

4948
class VoiceChat(Chat):
@@ -520,9 +519,10 @@ def _check_needed_imports():
520519
"Module `sounddevice`, needed for local audio recording, is not available."
521520
)
522521

523-
if not _pydub_imported:
524-
raise ImportError(
525-
"Module `pydub`, needed for audio conversion, is not available."
522+
if not _pydub_usable:
523+
logger.error(
524+
"Module `pydub`, needed for audio conversion, doesn't seem to be working. "
525+
"Voice chat may not be available or may not work as expected."
526526
)
527527

528528

0 commit comments

Comments
 (0)