[Zope] Broken Pipe Error
Asad Habib
ahabib at engin.umich.edu
Wed Dec 7 16:47:07 EST 2005
I am using Maik Jablonski's python script to convert from html to pdf in
conjunction with the htmldoc product. FYI, I am running Mac OS X
Tiger. When I run the script, I get the following error which is being
generated by line 20 of the script:
IOError: [Errno 32] Broken pipe
line 20 is as follows: stin.write(html)
The script is as follows:
import AccessControl, os
def html2pdf(self):
""" html2pdf converts a HTML-Page to a PDF-Document """
securityContext=AccessControl.getSecurityManager()
if securityContext.checkPermission('View', self):
if self.meta_type=='Folder':
html =
self.index_html(self,self.REQUEST,self.REQUEST.RESPONSE)
else:
html =
self(self,self.REQUEST,self.REQUEST.RESPONSE)
(stin,stout) = os.popen2('htmldoc --footer " : " --webpage
-t pdf --quiet --jpeg -')
stin.write(html)
stin.close()
pdf = stout.read()
stout.close()
self.REQUEST.RESPONSE.setHeader('Content-type','application/pdf')
self.REQUEST.RESPONSE.setHeader('Content-disposition','inline;
filename="%s.pdf"' % (self.getId()))
return pdf
else:
raise AccessControl.Unauthorized
Any help would be appreciated. Thanks.
- Asad
More information about the Zope
mailing list