hi
i want to redirect python compiler messages to a file.
for example

if i run a python which has a line

a=;2

python compiler will give me an error message saying 'syntax error'
how i can fetch this error and write it to a file?

i run it with

./test.py > log.txt

but it will output the error in console.

regards

Recommended Answers

All 3 Replies

In linux, you could use

./test.py 2&> log.txt

WoW, thanks alot Gribouillis :D
i greatly appreciated.
but can you please tell me the difference between mine and yours?
what the "2" is doing here?

regards

A simple > is equivalent to 1> . It redirects stdout to your file. A 2> redirects stderr. A google search with "linux redirection" should tell you all about redirection. For example, I found this http://en.wikipedia.org/wiki/Redirection_%28computing%29

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.