Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5299658

Browse files
committed
Fixes to utils.io.Tee
1 parent 1dcb5a6 commit 5299658

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

IPython/utils/io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Tee(object):
103103
# Inspired by:
104104
# http://mail.python.org/pipermail/python-list/2007-May/442737.html
105105

106-
def __init__(self, file_or_name, mode=None, channel='stdout'):
106+
def __init__(self, file_or_name, mode="w", channel='stdout'):
107107
"""Construct a new Tee object.
108108
109109
Parameters
@@ -119,7 +119,7 @@ def __init__(self, file_or_name, mode=None, channel='stdout'):
119119
if channel not in ['stdout', 'stderr']:
120120
raise ValueError('Invalid channel spec %s' % channel)
121121

122-
if hasattr(file, 'write') and hasattr(file, 'seek'):
122+
if hasattr(file_or_name, 'write') and hasattr(file_or_name, 'seek'):
123123
self.file = file_or_name
124124
else:
125125
self.file = open(file_or_name, mode)

0 commit comments

Comments
 (0)