Skip to content

Commit

Permalink
Merge pull request #75 from sciris/fix-saveobj
Browse files Browse the repository at this point in the history
Fix saveobj
  • Loading branch information
cliffckerr committed Jan 29, 2020
2 parents 53f891f + d0765e7 commit a7497e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions sciris/sc_fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,12 @@ def saveobj(filename=None, obj=None, compresslevel=5, verbose=0, folder=None, me
myobj = ['this', 'is', 'a', 'weird', {'object':44}]
saveobj('myfile.obj', myobj)
'''
if isinstance(filename, Path):
if isinstance(filename, Path): # If it's a path object, convert to string
filename = str(filename)
if filename is None:
if filename is None: # If it doesn't exist, just create a byte stream
bytesobj = io.BytesIO()
else:
else: # Normal use case: make a file path
bytesobj = None
filename = makefilepath(filename=filename, folder=folder, default='default.obj', sanitize=True)

with GzipFile(filename=filename, fileobj=bytesobj, mode='wb', compresslevel=compresslevel) as fileobj:
Expand Down
4 changes: 2 additions & 2 deletions sciris/sc_version.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__all__ = ['__version__', '__versiondate__', '__license__']

__version__ = '0.15.3'
__versiondate__ = '2019-12-15'
__version__ = '0.15.4'
__versiondate__ = '2020-01-28'
__license__ = 'Sciris %s (%s) -- (c) Sciris.org' % (__version__, __versiondate__)

0 comments on commit a7497e0

Please sign in to comment.