<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Susana,<br>
<br>
You're missing the beginning single quote (') before C:/Archivos....
and I don't think you need to escape the inner double quote ("), so
instead of<br>
<blockquote><tt>'\"LAYER= \'line\'\"'</tt><br>
</blockquote>
try<font face="courier new,monospace"><br>
</font>
<blockquote><tt>'"LAYER=\'line\'"'</tt><br>
</blockquote>
Also it would be easier to read the code if you did something like:<br>
<br>
<tt>ogr2ogr = 'C:/Archivos de programa/FWTools2.4.7/bin/ogr2ogr'<br>
inshape = line + '.shp'<br>
outshape = b + '.shp'<br>
query = '-where "LAYER=\'line\'" '<br>
<br>
p = subprocess.Popen([ogr2ogr, inshape, query, outshape])</tt><br>
<br>
hope that helps,<br>
<pre class="moz-signature" cols="72">matt wilkie
--------------------------------------------
Geomatics Analyst
Information Management and Technology
Yukon Department of Environment
10 Burns Road * Whitehorse, Yukon * Y1A 4Y9
867-667-8133 Tel * 867-393-7003 Fax
<a class="moz-txt-link-freetext" href="http://environmentyukon.gov.yk.ca/geomatics/">http://environmentyukon.gov.yk.ca/geomatics/</a>
-------------------------------------------- </pre>
<br>
On 07/10/2010 9:19 AM, Susana Iraiis Delgado Rodriguez wrote:
<blockquote
cite="mid:AANLkTim+fvk16sh9w18X1vBfBjK+boKa8=AjeT2zkj52@mail.gmail.com"
type="cite">
<div>Hello members!</div>
<div> </div>
<div>I'm running a python script to execute an ogr2ogr command.
The process has been sucessful, but now I want to create a shp
for each layer a shp has. I now I must use the command :</div>
<div><font face="Courier New" size="2">ogr2ogr newX.shp -where
"LAYER = 'layerValueX'" original.shp</font></div>
<div><font face="arial,helvetica,sans-serif">The code for the
subprocess is as follows:</font></div>
<div><font face="courier new,monospace">for line in
open("unico.txt", "r").readlines():<br>
p = subprocess.Popen([C:/Archivos de
programa/FWTools2.4.7/bin/ogr2ogr', line+'.shp', </font></div>
<div><font face="courier new,monospace">' -where', '\"LAYER=
\'line\'\"', b+'.shp'])</font><font
face="arial,helvetica,sans-serif">unfortuanely wtih this code
the module reads the variable line, which as the value of the
layer has a string "line": The problem is located after the
word LAYER, I don't have idea about the properly way to write
the quotes.</font></div>
<div> </div>
<div>Hope you can help, regards!</div>
<p style="color: rgb(0, 0, 0);"><br>
</p>
</blockquote>
</body>
</html>