Hi Leo,
  I'm not familiar with the Zope side of the world at all, so this may be
completely useless...

> However, if one tries to consume a NamedTemporaryFile and then open its
> generated blob before closing the tempfile, Windows complains:
> 
> 
> 
> >>>> import ZODB.blob, tempfile
> >>>> f = tempfile.NamedTemporaryFile()
> >>>> b = ZODB.blob.Blob()
> >>>> b.consumeFile(f.name)
> >>>> b.open('r')
> > Traceback (innermost last):
> > ...
> > IOError: [Errno 13] Permission denied:
> 'c:\\buildout\\var\\tmp\\tmpsuykkc'
> >
...

> unless we use some non-portable win32 code to allow writing and 
> reading to the same file simultaneously.

I'm not sure exactly what you mean by "simultaneously", but assuming you
just need the ability to read and write to a file, you already can.  Does
this behaviour help?

>>> import tempfile
>>> f = tempfile.NamedTemporaryFile()
>>> f.write("hello")
>>> f.seek(0,0)
>>> f.read()
'hello'

I can easily see it might not - as soon as the file is closed you have
(obviously) lost it.

Mark


_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to