try:
self.thr = SomeThreadClass()
time.sleep(1)
self.thr.start()
except Exception, error:
print str(error)
class SomeThreadClass:
def run(self):
try:
some_action()
except Exception, error:
raise Exception('Some action failed')
try:
self.thr = SomeThreadClass()
time.sleep(1)
self.thr.start()
except Exception, error:
print str(error)
class SomeThreadClass:
def run(self):
try:
some_action()
except Exception, error:
raise Exception('Some action failed')
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from multiprocessing import Queue, Process
class MyMegaException(Exception): pass
def deadlytask(queue):
queue.put(MyMegaException("Kranty 6"))
def main():
queue = Queue()
task = Process(target=deadlytask, args=(queue,))
task.start()
while task.is_alive():
data = queue.get()
raise data
if __name__ == '__main__':
main()