Possible to import from an in-memory zipfile stored in a cString?
Tim Chase
python.list at tim.thechases.com
Fri Apr 30 11:01:46 EDT 2010
On 04/30/2010 08:55 AM, python at bdurham.com wrote:
> Any ideas on whether or not it is possible to import from an
> in-memory zipfile stored in a cString vs. an on disk zipfile?
Based on the source-code to zipfile.py on my Debian machine, it
looks like the zipfile.ZipFile constructor takes a "file"
parameter. It then checks if it's a string (isinstance() of
basestring) and opens that file if it is; otherwise, it assumes
it's a file-like object and uses that, so in theory, you should
be able to do something like
fp = cString(...)
zf = zipfile.ZipFile(fp, ...)
and it should Just Work(tm).
-tkc
More information about the Python-list
mailing list