Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/chfw/pyexcel-text
Browse files Browse the repository at this point in the history
  • Loading branch information
chfw committed Jun 11, 2015
2 parents 5f0a13f + a430bd9 commit 8c4e3b7
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions pyexcel_text/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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()


Expand All @@ -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
Expand Down

0 comments on commit 8c4e3b7

Please sign in to comment.