[Zope] trying to open a file in database but couldn't
Allen Huang
swapp0 at yahoo.com
Sun Feb 26 06:52:14 EST 2006
Hi.. thanks for replying and thanks for the help
I didn't realize that I mis type the code. The code what suppose to be ..
imageDataFile=StringIO(str(dataID.data))
tfw = open(imageDataFile, "r")
so, what your saying is that I don't need to open the file that I wanted to read into and extract the data? But how can that be?
I originally used tried by extracting info from a file on the computer and it works. But I couldn't do the same thing from the web.. I don't get that I did wrong or missing...
How would you write the external method if you were to read a text file that you store in ZOPE database and extract the infromation line by line?
Andreas Jung <lists at andreas-jung.com> wrote:
--On 25. Februar 2006 21:55:24 -0800 Allen Huang 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
---------------------------------
Yahoo! Mail
Use Photomail to share photos without annoying attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20060226/054cb934/attachment.htm
More information about the Zope
mailing list