I did try that and got the following error message:<br><br>"Windows cannot find '-f'. Make sure that you typed the name correctly, and then try again."<br><br><div class="gmail_quote">On Mon, Feb 20, 2012 at 5:49 PM, Paul Ramsey <span dir="ltr"><<a href="mailto:pramsey@opengeo.org">pramsey@opengeo.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Your quotes are misplaced, try<br>
<div class="im"><br>
os.system('start "C:\Program Files (x86)\PostgreSQL\9.1\bin\pgsql2shp.exe" -f<br>
D:\testShapefile.shp -h localhost -u postgres -p 5432 test_db "SELECT * FROM<br>
myschema.testquery"')<br>
<br>
<br>
</div><div><div class="h5">On Mon, Feb 20, 2012 at 2:24 PM, David Quinn <<a href="mailto:daithiquinn@gmail.com">daithiquinn@gmail.com</a>> wrote:<br>
> I'm trying to call the pgsql2shp.exe function using python, as I would like<br>
> to be able to loop through some tables. What I've tried doing is the<br>
> following:<br>
><br>
> import os<br>
> os.system('start "C:\Program Files (x86)\PostgreSQL\9.1\bin\pgsql2shp.exe -f<br>
> D:\testShapefile.shp -h localhost -u postgres -p 5432 test_db "SELECT * FROM<br>
> myschema.testquery""')<br>
><br>
> When I paste the line:<br>
><br>
> C:\Program Files (x86)\PostgreSQL\9.1\bin\pgsql2shp.exe -f<br>
> D:\testShapefile.shp -h localhost -u postgres -p 5432 test_db "SELECT * FROM<br>
> myschema.testquery"<br>
><br>
> it produces a shapefile without a problem. However, my python script flashes<br>
> open a CMD terminal, but it disappears before I see what is happening and<br>
> does not produce any output. I'm using PostGIS 2.0, Windows 7, and Python<br>
> 2.6.5.<br>
> If there is an alternative approach to python for this, I will happily try<br>
> it out.<br>
><br>
> (I hope this question is not too off-topic!)<br>
><br>
> Thanks,<br>
> David<br>
><br>
><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
> <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
><br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</blockquote></div><br>