4

When I try to run the following code:

def sub_job_test():
    global trace_back_msg
    wait_time = 3 #random.randrange(0,13)
    time.sleep(wait_time)
    print("sub_job_test()")
    try:
        if wait_time < 4:
            raise FileExistsError
    except:
        trace_back_msg= "".join(traceback.format_exception(*sys.exc_info()))




proc = multiprocessing.Process(target=sub_job_test)
start_time = time.time()
timeout = 7
proc.start()
proc.join(timeout=timeout)
proc.terminate()

I have a few problems:

  1. If I create a breakpoint in the sub_job_test, it will never be called. Why is that, and how can I get the breakpoint to be called?
  2. No print from the sub_job_test ever gets printed to the terminal... Is there a way to pass the print to the terminal?
  3. The exception does not get passed to the terminal. Is there a way to do it?
An old man in the sea.
  • 1,169
  • 1
  • 13
  • 30
  • 1
    If you vote to close, at least leave a comment with a suggestion to improve. – An old man in the sea. Feb 23 '22 at 14:15
  • by the way, if my question lacks focus, what would you say of questions like this? https://stackoverflow.com/questions/100003/what-are-metaclasses-in-python?rq=1 And yet, the question is highly useful to the community as the votes show. – An old man in the sea. Feb 23 '22 at 14:17

0 Answers0