forked from auracaster/bumble_mirror
fix import checking
This commit is contained in:
@@ -675,7 +675,7 @@ async def run_receive(
|
|||||||
try:
|
try:
|
||||||
if not audio_io.check_audio_output(output):
|
if not audio_io.check_audio_output(output):
|
||||||
return
|
return
|
||||||
except ValueError as error:
|
except (ValueError, ImportError, OSError) as error:
|
||||||
print(error)
|
print(error)
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -820,7 +820,7 @@ async def run_transmit(
|
|||||||
try:
|
try:
|
||||||
if not audio_io.check_audio_input(input):
|
if not audio_io.check_audio_input(input):
|
||||||
return
|
return
|
||||||
except ValueError as error:
|
except (ValueError, ImportError, OSError) as error:
|
||||||
print(error)
|
print(error)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -82,10 +82,13 @@ def check_audio_output(output: str) -> bool:
|
|||||||
if output == 'device' or output.startswith('device:'):
|
if output == 'device' or output.startswith('device:'):
|
||||||
try:
|
try:
|
||||||
import sounddevice
|
import sounddevice
|
||||||
except (ImportError, OSError) as exc:
|
except ImportError as exc:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
'audio output not available '
|
'audio output not available (sounddevice python module not installed)'
|
||||||
'(sounddevice python module not installed or failed to load)'
|
) from exc
|
||||||
|
except OSError as exc:
|
||||||
|
raise ValueError(
|
||||||
|
'audio output not available (sounddevice python module failed to load)'
|
||||||
) from exc
|
) from exc
|
||||||
|
|
||||||
if output == 'device':
|
if output == 'device':
|
||||||
@@ -294,10 +297,13 @@ def check_audio_input(input: str) -> bool:
|
|||||||
if input == 'device' or input.startswith('device:'):
|
if input == 'device' or input.startswith('device:'):
|
||||||
try:
|
try:
|
||||||
import sounddevice
|
import sounddevice
|
||||||
except (ImportError, OSError) as exc:
|
except ImportError as exc:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
'audio input not available '
|
'audio input not available (sounddevice python module not installed)'
|
||||||
'(sounddevice python module not installed or failed to load)'
|
) from exc
|
||||||
|
except OSError as exc:
|
||||||
|
raise ValueError(
|
||||||
|
'audio input not available (sounddevice python module failed to load)'
|
||||||
) from exc
|
) from exc
|
||||||
|
|
||||||
if input == 'device':
|
if input == 'device':
|
||||||
|
|||||||
Reference in New Issue
Block a user