<div class="gmail_quote">On Thu, Oct 7, 2010 at 12:48 PM, taserian <span dir="ltr">&lt;<a href="mailto:taserian@gmail.com">taserian@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I&#39;m adding some line breaks to make your text a little more readable.<br><br><div class="gmail_quote">On Thu, Oct 7, 2010 at 9:55 AM, Susana Iraiis Delgado Rodriguez <span dir="ltr">&lt;<a href="mailto:susana.delgado_s@utzmg.edu.mx" target="_blank">susana.delgado_s@utzmg.edu.mx</a>&gt;</span> wrote:<div>
<div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">
<div>Hello members:</div><div> </div><div>How can I write a statement to execute the following:</div><div></div></blockquote><div> </div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

<div>C:/Archivos de programa/FWTools2.4.7/bin/ogr2ogr R1G-GEODESIA.shp -where &quot;LAYER = &#39;R1G-GEODESIA&#39;&quot; tapalpa_05_plani_point.dbf</div></blockquote><div> </div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

<div>I want my uotput to look like this.</div><div>Instead I&#39;m getting this</div></blockquote><div> </div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

<div>C:/Archivos de programa/FWTools2.4.7/bin/ogr2ogr T21-PUENTES.shp -where LAYER=+line tapalpa_05_plani_line.shp</div><div></div></blockquote><div> </div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

<div>In miy code line is a string given by the user:</div><div> </div><div>for line in open(&quot;unico.txt&quot;, &quot;r&quot;).readlines():</div><div>     p = subprocess.Popen([&#39;C:/Archivos de programa/FWTools2.4.7/bin/ogr2ogr&#39;, line+&#39;.shp&#39;, &#39;-where&#39;, &quot;LAYER=&#39;line&#39;&quot;, b+&#39;.shp&#39;])</div>

<div> </div><div>Any suggestions?</div></blockquote><div><br></div></div></div><div>Without knowing specifics about what the subprocess.Popen function is expecting as parameters, I can only speculate, but it seems that the following *might* work (for extremely generous values of &quot;*might*&quot;):</div>
<div class="im">
<div><br></div><div><div>for line in open(&quot;unico.txt&quot;, &quot;r&quot;).readlines():</div><div>     p = subprocess.Popen([&#39;C:/Archivos de programa/FWTools2.4.7/bin/ogr2ogr&#39;, line+&#39;.shp&#39;, &#39;-where&#39;, &quot;\&quot;LAYER=&#39;&quot; + line + &quot;&#39;\&quot;&quot;, b+&#39;.shp&#39;])</div>

</div><div><br></div></div><div>Details about where the changes are:</div><div>&quot;\&quot;LAYER=&#39;&quot; + line + &quot;&#39;\&quot;&quot;</div></div></blockquote><div><br></div><div>Begin corrections (corrections start with a *) </div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote"><div></div><div>Quote to begin the literal: &quot;</div><div>An escaped quote (1) so that there&#39;s a quote inside the literal: \&quot;</div>

<div>Some of the text that&#39;s meant to be unchanging: LAYER=</div></div></blockquote><div>*Single Quote (2) to be included in the literal (which doesn&#39;t need to be escaped): &#39;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div>Close Quote: &quot;</div></div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote"><div>Add the content of the variable &quot;line&quot; from the unico.txt file:  + line +</div>
</div></blockquote><div>*Add another literal, composed of the single quote that closes (2) above, then the closing escaped quote to close (1) : &quot;&#39;\&quot;&quot; </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="gmail_quote"><div><br></div><div>See if this works, and let us know how it turns out.</div><div><br></div><div>Antonio Rodriguez</div></div>
</blockquote></div><div><br></div><div>End of corrections.</div><br><div>Antonio Rodriguez</div>