[Zope] trying to open a file in database but couldn't

Andreas Jung lists at andreas-jung.com
Sun Feb 26 05:37:05 EST 2006



--On 25. Februar 2006 21:55:24 -0800 Allen Huang <swapp0 at yahoo.com> wrote:


>     imageDataFile=StringIO(str(imageData.data))
>       tfw = open(imageDataFile, "r")
>

Please consult the StringIO documentation. There is no need to open()
a StringIO instance...also your code makes little sense to me because
str() already returns a string which is usually what you need and want.
Why do you have the need to put the image data into a StringIO instance.
And another point: you should always use cStringIO instead of StringIO
(for performance reasons)...consult the Python Library reference for 
details.
-aj

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20060226/d6ae7fea/attachment.bin


More information about the Zope mailing list