[SciPy-User] Bug in scipy.io.mmread?

Pauli Virtanen pav@iki...
Thu Mar 22 14:50:04 CDT 2012

22.03.2012 14:42, Jaakko Luttinen kirjoitti:
> Python 3.2.2 (default, Oct 27 2011, 13:08:00)
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import scipy
>>>> scipy.version.version
> '0.11.0.dev-Unknown'
>>>> from scipy.io import mmread
>>>> mmread('illc1033.mtx.gz')

Note that this succeeds if you gunzip the file first.

This is a bug in the gzip module in Python 3.x. The
PyObject_AsFileDescriptor call on a GzipFile object succeeds on
Python 3, although it should fail (there is no OS level file handle
giving the uncompressed stream). As a consequence, mmio ends up reading
the compressed data stream, which of course does not work.

It's possible to work around this in mmio.

Pauli Virtanen

More information about the SciPy-User mailing list