aF.
aF.

Reputation: 66697

How to close stdout/stderr window in python?

In my python app, I print some stuff during a cycle.

After the cycle, I want to close the stdout/stderr window that the prints produced using python code.

Upvotes: 0

Views: 4179

Answers (2)

rbp
rbp

Reputation: 45020

If you mean the prompt window that opens when you run a Python script on MS Windows, try specifying the executable pythonw instead of python, on the first line of your script.

Upvotes: 0

jdizzle
jdizzle

Reputation: 4154

import sys

sys.stdout.close()
sys.stderr.close()

Might be what you want. This will certainly close stdout/stderr at any rate.

Upvotes: 7

Related Questions