Re: How to catch python's STDOUT

2006-07-31 Thread Greg Ewing
[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 obje

Re: How to catch python's STDOUT

2006-04-06 Thread Peter Hansen
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 ge

Re: How to catch python's STDOUT

2006-04-06 Thread Sybren Stuvel
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 th

Re: How to catch python's STDOUT

2006-04-06 Thread Sybren Stuvel
[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

Re: How to catch python's STDOUT

2006-04-06 Thread Fredrik Lundh
[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

Re: How to catch python's STDOUT

2006-04-06 Thread Steven D'Aprano
[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 >>>

Re: How to catch python's STDOUT

2006-04-06 Thread praveenkumar . 117
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 t

Re: How to catch python's STDOUT

2006-04-06 Thread Sybren Stuvel
[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

Re: How to catch python's STDOUT

2006-04-06 Thread Fredrik Lundh
[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 write(s

How to catch python's STDOUT

2006-04-06 Thread praveenkumar . 117
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