Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First, <code>subprocess.Popen</code>'s first arg should generally be a list (unless you also pass <code>shell=True</code>). The <code>No such file or directory</code> is almost certainly caused by the absence of a file named <code>"htmldoc -t pdf --quiet '...</code> on the system (it's trying to find and run the program named for the whole string value). </p> <p>Second, if you give htmldoc some html on its stdin, it'll spit out a pdf on its stdout, thus avoiding the need for a temporary file. </p> <p>Give this a try (untested):</p> <pre><code>htmldoc = subprocess.Popen( ['/usr/bin/htmldoc', '-t', 'pdf', '--webpage', '-'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE ) stdout, stderr = htmldoc.communicate(html) </code></pre> <p>NB: substitute <code>/usr/bin/htmldoc</code> for the real path to htmldoc on your system. </p> <p>The <code>-</code> argument to the htmldoc program, tells it to read from stdin. You'll pass your html string value (<code>html</code>) to htmldoc's <code>stdin</code> as an argument to the <code>htmldoc.communicate</code> call. The resulting pdf output should be available in <code>stdout</code>, and any other messages or stats in <code>stderr</code>. </p> <p><strong>Edit</strong>: The documentation does seem a bit wonky, but there is quite a bit of it. You might have better luck with the <a href="https://www.msweet.org/documentation/project1/HTMLDOC.html" rel="nofollow">html in one page</a> or <a href="https://www.msweet.org/documentation/project1/HTMLDOC.pdf" rel="nofollow">pdf</a> versions, or the <a href="http://manpages.ubuntu.com/manpages/oneiric/en/man1/htmldoc.1.html" rel="nofollow">man page</a>. </p> <p>Also, be sure to pass a string, or similar, to the stdin of the htmldoc process. Passing a StringIO object directly, as was implied by my previous code snippet, won't work. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload