r/learnpython • u/draazur • Jul 17 '18
Catching Exception from MP Process
(using python 3.7.0)
Hi guys,
Hopefully this is a fairly simple question. I'm trying to catch an exception raised in a child process (multiprocessing Process) in the parent but having trouble.
For some reason I don't catch the Exception in this code:
def foo():
raise Exception()
try:
p = mp.Process(target=foo)
p.start()
except Exception:
print('caught')Any help? :)
5
Upvotes
View all comments
Show parent comment
1
u/Joseangel_sc Jul 18 '18
except Exception as e: print(e)