Index: grammalecte-server.py ================================================================== --- grammalecte-server.py +++ grammalecte-server.py @@ -318,10 +318,14 @@ 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) @@ -347,5 +351,9 @@ main(xArgs.host or "localhost", \ xArgs.port or 8080, \ dOpt, xArgs.test_page, xArgs.multiprocessor) +else: + # we do it for the server may be used with WSGI (which doesn’t call main()) + # WSGI servers just import the given file as a module and use an object exported from it ( in this case) to run the server. + initExecutor()