diff --git a/pyexcel_text/__init__.py b/pyexcel_text/__init__.py index d5419af..4ffa9fb 100644 --- a/pyexcel_text/__init__.py +++ b/pyexcel_text/__init__.py @@ -122,12 +122,13 @@ def close(self): class TextWriter(BookWriter): - def __init__(self, file, **keywords): - BookWriter.__init__(self, file, **keywords) - if is_string(type(file)): - self.f = open(file, 'w') + def __init__(self, filename, **keywords): + BookWriter.__init__(self, filename, **keywords) + if is_string(type(filename)): + self.f = open(filename, 'w') else: - self.f = file + self.f = filename + self.filename = filename def create_sheet(self, name): return TextSheetWriter( @@ -137,7 +138,7 @@ def create_sheet(self, name): **self.keywords) def close(self): - if is_string(type(file)): + if is_string(type(self.filename)): self.f.close() @@ -155,8 +156,8 @@ def close(self): class JsonWriter(TextWriter): - def __init__(self, file, **keywords): - TextWriter.__init__(self, file, **keywords) + def __init__(self, filename, **keywords): + TextWriter.__init__(self, filename, **keywords) def write(self, sheet_dicts): import json