Currently, it is possible to read files saved to disk but not file-like objects (like StringIO) with idlsave.read. A nice addition would be to have two parameters to specify the SAV file: "file_name" and "file_obj" (see the gzip.GzipFile constructor in the standard Python library for an example).
It would be nice to have such a feature, as I often have to read gzipped SAV files downloaded from a FTP server: I can download and decompress them only using StringIO objects, but then I must save the result in a temporary file before calling idlsave.read.
I am attaching here a possible patch which implements what I described. There should be no change required for existing code. The following snippet illustrates the new feature:
from gzip import GzipFile
d = idlsave.read (file_obj = GzipFile ('foo.sav.gz'))
Log in to post a comment.