I am building an app. While deploying in Windows server I don’t want the console opening. But when I try to do so in .pyw
form it does noting
run.pyw 1>stdout.txt 2>stderr.txt
calls the following code:
import uvicorn
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
Neither do I get any error nor any output. Nor does the API works.
Is it even possible to run in no console mode?
Add the following argument to your uvicorn.run call “use_colors=False”
It defaults to true, and causes uvicorn to crash if sys.stdout is not the expected class (ie. if you replace with a custom logger, or in the case of using pythonw.exe I believe it’s simply ‘None’)