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

Exception in Thread 1 #130

Closed
Marlon154 opened this issue Oct 10, 2024 · 2 comments
Closed

Exception in Thread 1 #130

Marlon154 opened this issue Oct 10, 2024 · 2 comments

Comments

@Marlon154
Copy link

Hello, I can not run the tests.
I setup the environment with cuda in conda (on linux), but running the tests from the repo always fails.
I tried different python versions: 3.9, 3.11 but none of them work.
The exception is always the ValueError: signal only works in main thread of the main interpreter

python realtimestt_test.py                                                                                                                                                                                                                                                                          INT ✘  5s   realtimestt  
System initializing, please wait
Exception in thread Thread-3 (_audio_data_worker):
Traceback (most recent call last):
  File "/home/marlon/.conda/envs/realtimestt/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
Exception in thread Thread-2 (_transcription_worker):
Traceback (most recent call last):
  File "/home/marlon/.conda/envs/realtimestt/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
    self.run()
    self.run()
  File "/home/marlon/.conda/envs/realtimestt/lib/python3.11/threading.py", line 982, in run
  File "/home/marlon/.conda/envs/realtimestt/lib/python3.11/threading.py", line 982, in run
    self._target(*self._args, **self._kwargs)
    self._target(*self._args, **self._kwargs)
  File "/home/marlon/.conda/envs/realtimestt/lib/python3.11/site-packages/RealtimeSTT/audio_recorder.py", line 897, in _audio_data_worker
  File "/home/marlon/.conda/envs/realtimestt/lib/python3.11/site-packages/RealtimeSTT/audio_recorder.py", line 862, in _transcription_worker
    system_signal.signal(system_signal.SIGINT, system_signal.SIG_IGN)
  File "/home/marlon/.conda/envs/realtimestt/lib/python3.11/signal.py", line 58, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: signal only works in main thread of the main interpreter
    worker.run()
  File "/home/marlon/.conda/envs/realtimestt/lib/python3.11/site-packages/RealtimeSTT/audio_recorder.py", line 124, in run
    system_signal.signal(system_signal.SIGINT, system_signal.SIG_IGN)
  File "/home/marlon/.conda/envs/realtimestt/lib/python3.11/signal.py", line 58, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: signal only works in main thread of the main interpreter

Even this simple example fails:

from RealtimeSTT import AudioToTextRecorder

def process_text(text):
    print(text)

if __name__ == '__main__':
    recorder = AudioToTextRecorder()

    while True:
        recorder.text(process_text)

with the same error as above.

@KoljaB
Copy link
Owner

KoljaB commented Oct 10, 2024

Please look here (check current version from repo, release coming soon)

@Marlon154
Copy link
Author

It work, thank you!

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