[Zope] contents of File as string: acquisition wrapper problem

John Hunter jdhunter at ace.bsd.uchicago.edu
Fri Aug 27 16:08:09 EDT 2004


What is the proper way to get the contents of a File as a string from
the python API?

I am doing 

        zip = zipfile.ZipFile(tmpfile, 'w')

        for fileo in self._subfileFolder.objectValues('File'):
            fname = fileo.getId()
            zip.writestr(fname, fileo.data)
        zip.close()

But the call to writestr raises


Error Type: TypeError
Error Value: crc32() argument 1 must be string or read-only buffer, not ImplicitAcquirerWrapper

Traceback (innermost last):

    * Module ZPublisher.Publish, line 101, in publish
    * Module ZPublisher.mapply, line 88, in mapply
    * Module ZPublisher.Publish, line 39, in call_object
    * Module Products.irbworkflow.CRCFlow, line 1603, in all_zipped
    * Module zipfile, line 460, in writestr

TypeError: crc32() argument 1 must be string or read-only buffer, not ImplicitAcquirerWrapper

  
So it appears data is wrapped by the acquisition machinery.

Any ideas?

Thanks,
John Hunter

zope 2.7


More information about the Zope mailing list