Popular recipes tagged "processes"http://code.activestate.com/recipes/tags/processes/2015-12-27T20:45:32-08:00ActiveState Code RecipesPublish a Windows Process List to PDF with xtopdf (Batch)
2015-12-27T20:45:32-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579142-publish-a-windows-process-list-to-pdf-with-xtopdf/
<p style="color: grey">
Batch
recipe 579142
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/pdf/">pdf</a>, <a href="/recipes/tags/pdfwriter/">pdfwriter</a>, <a href="/recipes/tags/pdf_generation/">pdf_generation</a>, <a href="/recipes/tags/processes/">processes</a>, <a href="/recipes/tags/process_management/">process_management</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/windows/">windows</a>).
</p>
<p>This recipe shows how you can generate a Windows process list or task list (basically, a list of running processes, with some information about each of them), to a PDF file, using the Windows TASKLIST command along with the xtopdf toolkit. The list is sorted in ascending order of memory usage of the processes, before writing it to PDF.</p>
<p>It differs somewhat from other xtopdf recipes, in that no additional code needs to be written, over and above what is already in the xtopdf package. We just have to use the needed commands there, in a series of commands or a pipeline.</p>
<p>However, one can still write additional code, by modifying the program used (StdinToPDF.py), if needed, to customize the PDF output.</p>
Simple invocation of shell commands (Python)
2011-10-21T06:44:35-07:00Nick Coghlanhttp://code.activestate.com/recipes/users/2035254/http://code.activestate.com/recipes/577891-simple-invocation-of-shell-commands/
<p style="color: grey">
Python
recipe 577891
by <a href="/recipes/users/2035254/">Nick Coghlan</a>
(<a href="/recipes/tags/processes/">processes</a>, <a href="/recipes/tags/shell/">shell</a>).
Revision 3.
</p>
<p>Some simple wrappers around the subprocess functions for use in system administration utilities that frequently need to interpolate trusted data into shell commands (e.g. filenames from directory listings, etc):</p>
<pre class="prettyprint"><code>import shellcmd
return_code = shellcmd.shell_call('ls -l {}', dirname)
listing = shellcmd.check_shell_output('ls -l {}', dirname)
</code></pre>
<p>Each function invokes the subprocess function of the same name with <code>shell=True</code> and the supplied command string. Any positional and keyword arguments provided to the call are interpolated into the command string with the <code>str.format</code> method.</p>