<div dir="ltr"><div>Yes, it works fine for me. Not sure if there is a better way to do this. I am happy for now.</div>
<div>&nbsp;</div>
<div>Ton of thanks to everyone for help. You guys are great.</div>
<div>&nbsp;</div>
<div>David<br><br></div>
<div class="gmail_quote">On Thu, Aug 21, 2008 at 10:12 AM, Eric Walstad <span dir="ltr">&lt;<a href="mailto:eric@ericwalstad.com">eric@ericwalstad.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d">On Thu, Aug 21, 2008 at 9:30 AM, David Elsen &lt;<a href="mailto:elsen.david08@gmail.com">elsen.david08@gmail.com</a>&gt; wrote:<br>&gt; Shannon,<br>&gt; It is a very big reference for a very small question. I tried to glance and<br>
&gt; could not get my solution.<br>&gt;<br>&gt; Thanks a lot for the reference though,<br>&gt; David<br>&gt;<br>&gt; On Wed, Aug 20, 2008 at 5:59 PM, Shannon -jj Behrens &lt;<a href="mailto:jjinux@gmail.com">jjinux@gmail.com</a>&gt;<br>
&gt; wrote:<br></div>
<div class="Ih2E3d">&gt;&gt; Have a peek at <a href="http://docs.python.org/lib/module-subprocess.html" target="_blank">http://docs.python.org/lib/module-subprocess.html</a>.<br>&gt;&gt; This has the additional benefit that you can pass a list of args<br>
&gt;&gt; instead of a single string.<br><br></div>Consider:<br>
<div class="Ih2E3d">def reg_read(self, offset):<br></div>&nbsp; &nbsp;import subprocess<br>&nbsp; &nbsp;read_cmd = &#39;./testtool&#39;<br>&nbsp; &nbsp;args = (read_cmd, offset)<br>&nbsp; &nbsp;process = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE)<br>
&nbsp; &nbsp;return_code = process.wait()<br>&nbsp; &nbsp;read_content = process.stdout.read()<br><br>This stuffs the read_cmd and the offset into a tuple which is then<br>used as the first argument to create a Popen object. &nbsp;Doing it this<br>
way means that you don&#39;t have to worry about formatting the read_cmd<br>into something that includes the arguments passed into the testtool<br>executable - Popen handles that for you.<br></blockquote></div><br></div>