David

Just to be sure: You did make one single line without line breaks from the mail?

os.system('start "C:\Program Files
(x86)\PostgreSQL\9.1\bin\pgsql2shp.exe" -f D:\testShapefile.shp -h
localhost -u postgres -p 5432 test_db "SELECT * FROM
myschema.testquery"')

-Stefan

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

Reply via email to