The relevant code is actually from a separate thread.
Here it is anyway
import multiprocessing
from playsound import playsound
p = multiprocessing.Process(target=playsound, args=("file.mp3",))
p.start()
input("press ENTER to stop playback")
p.terminate()
When I run this exact code, I get the following error:
Traceback (most recent call last):
File "/Users/omit/Developer/omit/main2.py", line 22, in <module>
p2 = multiprocessing.Process(printStatus)
File "/opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 82, in __init__
assert group is None, 'group argument must be None for now'
AssertionError: group argument must be None for now
(yt-proj) omit@omit-Air youtube proj % /opt/homebrew/bin/python3 "/Users/omit/Developer/omit/main2.py"
Traceback (most recent call last):
File "/Users/omit/Developer/omit/main2.py", line 22, in <module>
p2 = multiprocessing.Process(printStatus)
File "/opt/homebrew/Cellar/[email protected]/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 82, in __init__
assert group is None, 'group argument must be None for now'
AssertionError: group argument must be None for now
What could be the problem?
The code to start the multiprocessing must never be "top level". It must only be run if this is the main thread.