Index: grammalecte-server.py ================================================================== --- grammalecte-server.py +++ grammalecte-server.py @@ -31,10 +31,13 @@ def initExecutor (nMultiCPU=None): "process pool executor initialisation" global xProcessPoolExecutor + if xProcessPoolExecutor: + # we shutdown the ProcessPoolExecutor which may have been launched previously + xProcessPoolExecutor.shutdown(wait=False) nMaxCPU = max(os.cpu_count()-1, 1) if nMultiCPU is None or not (1 <= nMultiCPU <= nMaxCPU): nMultiCPU = nMaxCPU print("CPU processes used for workers: ", nMultiCPU) xProcessPoolExecutor = concurrent.futures.ProcessPoolExecutor(max_workers=nMultiCPU) @@ -318,14 +321,10 @@ print("Python: " + sys.version) # Grammalecte echo("Grammalecte v{}".format(oGCE.version)) oGCE.displayOptions() # Process Pool Executor - if xProcessPoolExecutor: - # If the module is imported and main() launched, we must shutdown the ProcessPoolExecutor - # which has been launched previously - xProcessPoolExecutor.shutdown(wait=False) initExecutor(nMultiCPU) # Server (Bottle) run(app, host=sHost, port=nPort)