Show More
@@ -103,7 +103,7 b' class Tee(object):' | |||||
103 | # Inspired by: |
|
103 | # Inspired by: | |
104 | # http://mail.python.org/pipermail/python-list/2007-May/442737.html |
|
104 | # http://mail.python.org/pipermail/python-list/2007-May/442737.html | |
105 |
|
105 | |||
106 |
def __init__(self, file_or_name, mode= |
|
106 | def __init__(self, file_or_name, mode="w", channel='stdout'): | |
107 | """Construct a new Tee object. |
|
107 | """Construct a new Tee object. | |
108 |
|
108 | |||
109 | Parameters |
|
109 | Parameters | |
@@ -119,7 +119,7 b' class Tee(object):' | |||||
119 | if channel not in ['stdout', 'stderr']: |
|
119 | if channel not in ['stdout', 'stderr']: | |
120 | raise ValueError('Invalid channel spec %s' % channel) |
|
120 | raise ValueError('Invalid channel spec %s' % channel) | |
121 |
|
121 | |||
122 | if hasattr(file, 'write') and hasattr(file, 'seek'): |
|
122 | if hasattr(file_or_name, 'write') and hasattr(file_or_name, 'seek'): | |
123 | self.file = file_or_name |
|
123 | self.file = file_or_name | |
124 | else: |
|
124 | else: | |
125 | self.file = open(file_or_name, mode) |
|
125 | self.file = open(file_or_name, mode) |
General Comments 0
You need to be logged in to leave comments.
Login now