Vin
Vin

Reputation: 727

How to get a readable "script" output?

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

Upvotes: 0

Views: 381

Answers (2)

karlphillip
karlphillip

Reputation: 93410

./pyscript.py &> output.txt

or:

python script.py &> output.txt

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

Upvotes: 0

Hyperboreus
Hyperboreus

Reputation: 32429

Try:

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

Or for appending

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

Upvotes: 1

Related Questions