3

When a script is executed with pythonw it will not open a console.

Is there a way to capture the stdout of such a script by keeping the usage of pythonw?

Note, I am looking for a solution that does not require the modification of the script (I know that I can use logging)

Update: pythonw script.py >somefile seems to work. How can I redirect it to console?

0

2 Answers 2

3

It was obvious: pythonw script.py|more

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

Comments

1

If you can change how you invoke it (as you do in the update), why don't you just run it with python instead of pythonw?

python script.py

4 Comments

pythonw executes scripts in a different context and sometimes the scrip will behave different.
Seems like an odd thing for the script to do, but that's true I suppose.
Stop thinking about scripts as console-scripts, a python script can be a fully GUI application ;)
I realise that! :) What wasn't clear (to me) in your q. is that you aren't running the pythonw command in a console. But your solution makes sense.

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.