[Scipy-svn] r4125 - trunk/scipy/io

scipy-svn@scip... scipy-svn@scip...
Thu Apr 10 04:03:52 CDT 2008


Author: pearu
Date: 2008-04-10 04:03:43 -0500 (Thu, 10 Apr 2008)
New Revision: 4125

Modified:
   trunk/scipy/io/mmio.py
Log:
Add bz2 support to io.mmio [not tested]

Modified: trunk/scipy/io/mmio.py
===================================================================
--- trunk/scipy/io/mmio.py	2008-04-10 01:01:09 UTC (rev 4124)
+++ trunk/scipy/io/mmio.py	2008-04-10 09:03:43 UTC (rev 4125)
@@ -206,10 +206,15 @@
                         filespec = filespec + '.mtx'
                     elif os.path.isfile(filespec+'.mtx.gz'):
                         filespec = filespec + '.mtx.gz'
+                    elif os.path.isfile(filespec+'.mtx.bz2'):
+                        filespec = filespec + '.mtx.bz2'
                 # open filename
                 if filespec[-3:] == '.gz':
                     import gzip
                     stream = gzip.open(filespec, mode)
+                elif filespec[-4:] == '.bz2':
+                    import bz2
+                    stream = bz2.BZ2File(filespec, 'r')
                 else:
                     stream = open(filespec, mode)
      



More information about the Scipy-svn mailing list