Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a sounddevice callback swallows all errors #481

Open
escolanogui opened this issue Jul 26, 2023 · 4 comments
Open

a sounddevice callback swallows all errors #481

escolanogui opened this issue Jul 26, 2023 · 4 comments

Comments

@escolanogui
Copy link

Hi,
My issue is that just by importing sounddevice, any posterior error in the code is "swallowded", meaning not thrown by the terminal and the terminal just exits without throwing anything.
image
The image above is the closest i could get to having some logs of the error. To get this error i had to import sounddevice inside a function so as to have my code run before because any other way the error was just suppresed.

@escolanogui
Copy link
Author

it seems issue #468 has the same problem and might be due to import sounddevice.

@HaHeho
Copy link

HaHeho commented Jul 26, 2023

If the import of sounddevice crashes your Python interpreter, then there may be a problem with the Python environment in which you execute the code. You seem to be on Windows, but please describe how you set up Python and installed the sounddevice package (maybe pip or conda?).

@escolanogui
Copy link
Author

This is the info:

pip show sounddevice
Name: sounddevice
Version: 0.4.6
Summary: Play and Record Sound with Python
Home-page: http://python-sounddevice.readthedocs.io/
Author: Matthias Geier
Author-email: [email protected]
License: MIT
Location: c:\users\gescolano\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages
Requires: CFFI
Required-by:

The problem is that it doesn't crash the python interpreter. After an error occurs, instead of it being thrown to the terminal and stopping execution it just stops executing without giving any feedback. On my other computer with python 3.10 this doesn't happen...

For example:

import sounddevice as sd
stream = sd.InputStream()
stream.start()
print("Recording...")

output: "Recording..."

import torch
vad = torch.hub.load("snakers4/silero-vad", "silero_vad")
print("Recording...")

output: "Recording..."

import sounddevice as sd
import torch
vad = torch.hub.load("snakers4/silero-vad", "silero_vad")
stream = sd.InputStream()
stream.start()
print("Recording...")

output: (nothing). An error must have been thrown, for some reason and the execution just stops with no error thrown.

@HaHeho
Copy link

HaHeho commented Jul 26, 2023

The problem is that it doesn't crash the python interpreter. After an error occurs, instead of it being thrown to the terminal and stopping execution it just stops executing without giving any feedback. On my other computer with python 3.10 this doesn't happen...

This may be an indication that something in the Python environment on the faulty system is broken. You should try setting up a fresh and minimal environment containing only the Python packages you need for the specific project (or testing). I would usually use miniconda for that, but there may be simpler ways if you don't need to always handle different environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants