redefining stdout

Fredrik Lundh fredrik at pythonware.com
Fri Mar 16 11:59:14 EST 2001


Mark Limber wrote:
> However, when I try:
>
> >>> import sys
> >>> import t # short file names = less typing!
> >>> sys.stdout = t.myPrint

>>> sys.stdout = t.myPrint()

> >>> print "hey"
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: unbound method must be called with class instance
> 1st argument

Cheers /F





More information about the Python-list mailing list