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
Asad Habib wrote at 2005-12-7 16:47 -0500:
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
This means that you try to write into a pipe when the reading end of this pipe was closed (probably because the reader died). -- Dieter
Hi Dieter. Thanks for the input. Why would the reader die, though? I am running Mac OS X Tiger, if that helps any. Thanks. - Asad On Thu, 8 Dec 2005, Dieter Maurer wrote:
Asad Habib wrote at 2005-12-7 16:47 -0500:
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
This means that you try to write into a pipe when the reading end of this pipe was closed (probably because the reader died).
-- Dieter
Asad Habib wrote at 2005-12-8 14:55 -0500:
Why would the reader die, though?
I am no prophet, I cannot tell you. I can tell you though that the reader is almost surely the "popen2" process. Up to you to find out why it dies before the writer finished writing... -- Dieter
participants (2)
-
Asad Habib -
Dieter Maurer