[EMAIL PROTECTED] wrote:
I dont want the outputs of print to be displayed on the console
since it is used my fellow-workers
But i need those prints for debugging purpose
import sys
sys.stdout = open(my_debugging_output.txt, w)
Or you can replace sys.stdout with any object
Hi,
Can someone help me by suggesting how to capture python's
STDOUT. I doesn't want the python's output to get displayed on the
screen.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
Can someone help me by suggesting how to capture python's
STDOUT. I doesn't want the python's output to get displayed on the
screen.
you can replace sys.stdout (and/or sys.stderr) with your own file-like
object, e.g.
class NullStream:
def
[EMAIL PROTECTED] enlightened us with:
Can someone help me by suggesting how to capture python's STDOUT. I
doesn't want the python's output to get displayed on the screen.
python somescript.py /dev/null
Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital
HI,
I am a member of comp.lang.python.
I posted a message saying how to capture python's STDOUT.
sorry i did not clearly mentioned the problem.
I have python script in which i have some print statements.
I dont want the outputs of print to be displayed on
[EMAIL PROTECTED] wrote:
Hi,
Can someone help me by suggesting how to capture python's
STDOUT. I doesn't want the python's output to get displayed on the
screen.
import sys, StringIO
SAVEOUT = sys.stdout
capture = StringIO.StringIO()
sys.stdout = capture
print hello
But
[EMAIL PROTECTED] wrote:
I have python script in which i have some print statements.
I dont want the outputs of print to be displayed on the console
since it is used my fellow-workers
But i need those prints for debugging purpose
So some how i want to
[EMAIL PROTECTED] enlightened us with:
I have python script in which i have some print statements. I dont
want the outputs of print to be displayed on the console since it is
used my fellow-workers But i need those prints for debugging purpose
So some how i want to capture those prints can u
Fredrik Lundh enlightened us with:
or you can use the logging module:
http://docs.python.org/lib/module-logging.html
I'd definitely do that.
Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
Steven D'Aprano wrote:
import sys, StringIO
SAVEOUT = sys.stdout
capture = StringIO.StringIO()
sys.stdout = capture
print hello
But be warned, I've had difficulty restoring stdout
afterwards, and needed to exit the interactive
interpreter to get things back to normal.
If
10 matches
Mail list logo