0

When I run a python script I want to capture everything which is output on the screen. When I use the "script" command and capture the log in "typescript" file, the output in not readable when using vi. Its readable using

2
  • possible duplicate of Redirect stderr and stdout in a bash script Commented May 31, 2011 at 16:10
  • What do you mean that the output of the script command is not readable? I use this all the time. Commented May 31, 2011 at 16:18

2 Answers 2

1

Try:

python -u yourscript.py 1> log 2> err

Or for appending

python -u yourscript.py 1>> log 2>> err
Sign up to request clarification or add additional context in comments.

Comments

0
./pyscript.py &> output.txt

or:

python script.py &> output.txt

Note: redirects both stdout and stderr to output.txt.

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.