[PyQt] PyQt4 Python File Object to QFile
russ at coldstonelabs.org
Tue Feb 16 07:27:33 GMT 2010
Russell Valentine wrote:
> I wonder if anyone ever bridged the gap between QFile and the Python
> File Object? It could be handy sometimes to go between the two.
> How about for example if I wanted to open a file from a zip file.
> zfile = zipfile.ZipFile("test.zip")
> f=zfile.open("some.png", 'r')
> qtf = QPythonFile(f)
> f is a python file object but, how can I use this in Qt? I realize I
> could save it to some temp file and reopen it with QFile but that seems
This works for me for now. though I'm not having to read huge files
Another way would be to load up data in a QByteArray and put it in
QBuffer, but that still loads everything in memory, if you wanted to
just stream some big file in a zip.
Just thought I'd followup.
More information about the PyQt