I'm trying to make a GUI application that incorporates both image and audio processing simultaneously using the multiprocessing library. However the same code when tested on a Mac OS X does not seem to work, unless I remove the import tkinter statement
import pyaudio
# The import statement below is causing the problem
import tkinter as tki
import multiprocessing
import threading
def do_task():
p = pyaudio.PyAudio()
print("Task complete")
if __name__ == '__main__':
p = multiprocessing.Process(target=do_task, args=())
p.start()
# Code works when import statement is placed here
# import tkinter as tki
p.join()
The above code prints Task complete on Windows and also prints Task complete when the import statement is shifted, which is not a good solution as I'll need to start the multiprocessing after I initialize the UI.
Is there any workaround to this problem?