You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to convert a lot of text to audio at a time, say 1000 or so. Can I use multiprocessing using pool to generate the audio files faster?
This is what I've tried so far but to no avail:
This is a dataframe with columns post_id having a string value of numerical ids and summary also a string containing summaries of news articles.
from multiprocessing import Pool, get_context
pool_input = list(zip(df.post_id, df.summary))
with get_context("spawn").Pool() as p:
p.starmap(generate_audio, pool_input)
This is the error message I get, it seems like it sees the process in use.
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 125, in _main
prepare(preparation_data)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 236, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\Users\Admin\Desktop\Projects\NLP_Cron\cron_audio.py", line 100, in
[os.remove(f) for f in os.listdir() if f.endswith(".mp3")]
File "c:\Users\Admin\Desktop\Projects\NLP_Cron\cron_audio.py", line 100, in
[os.remove(f) for f in os.listdir() if f.endswith(".mp3")]
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'gtts_summary_18655565-c411-4bcf-97a2-d68b92f40af9.mp3'
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I wanted to convert a lot of text to audio at a time, say 1000 or so. Can I use multiprocessing using pool to generate the audio files faster?
This is what I've tried so far but to no avail:
This is a dataframe with columns post_id having a string value of numerical ids and summary also a string containing summaries of news articles.
This is the error message I get, it seems like it sees the process in use.
Beta Was this translation helpful? Give feedback.
All reactions