0

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?

1 Answer 1

0

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')

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.