1

I've been building a WebSocket application and I opted for Python FastAPI + Uvicorn for server side. Having pretty much finished the app, I decided to pack the server into an .exe file. Even though I used pyinstaller with --noconsole flag, whenever I launch my server using the following snippet:

config = uvicorn.Config(
            app, 
            host="0.0.0.0", 
            port=exposed_port, 
            access_log=False,
            reload=False,
            log_config=None
        )

server = uvicorn.Server(config)
server_thread = threading.Thread(target=server.run, daemon=True)
server_thread.start()

a cmd launches. The cmd does not contain any logs whatsoever, it is completely empty, but once I close it, the server shuts down.

Is there any way to either hide the cmd, or get rid of it fully?

1
  • You're using pythonw.exe as your executable right? (using the extension .pyw on your script will do this normally, but you might need to specify it manually when building a standalone exe)
    – kindall
    Commented 5 hours ago

0

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.