Reputation: 41
I get an error when trying to run ogr2ogr thru subprocess but I am able to run it using just the windows command prompt. The script will be part of a series of processes that start with batch importing gpx files unto a postgres db. Can somebody please tell me what's wrong? Thanks!
:::::::::::::::::::::::::::: Running THIS script gives me an ERROR: 'ogr2ogr' is not recognized as an internal or external command, operable program or batch file.
import subprocess
import sys
print sys.executable
track= "20131007.gpx"
subprocess.call(["ogr2ogr", "-f", "PostgreSQL", "PG:dbname=TTBASEMain host=localhost port=5432 user=postgres password=minda", track], shell=True)
::::::::::::::::::::::::::::: THIS CODE does its job well.
ogr2ogr -f PostgreSQL PG:"dbname='TTBASEMain' host='localhost' port='5432' user='postgres' password='minda'" "20131007.gpx"
::::::::::::::::::::::::::::: THIS is what I have in my environment path:
C:\Users\User>path PATH=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine C omponents\IPT;C:\Program Files\Lenovo\Bluetooth Software\;C:\Program Files\Lenovo\Bluetooth Software\syswow64;C:\lastools\bin;C:\Python27;C:\Python27\Scripts;C:\Python27\DLLs;C:\Python27\Lib\site-packages;C:\Users\User\AppData\Roaming.local\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\GDAL
Upvotes: 0
Views: 2766
Reputation: 41
REINSTALLING the python bindings resolved my issue. I don't see GDAL on the paths below but its working now. Is it supposed to be there so since its not, I might probably have another round of GDAL head scratching in the future?
::::::::::::::::::::::::::::::::::::::: THIS is what I currently have when I type in sys.path on python:
Microsoft Windows [Version 6.2.9200] (c) 2012 Microsoft Corporation. All rights reserved.
C:\Users\User>python Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
import sys sys.path ['', 'C:\windows\SYSTEM32\python27.zip', 'C:\Python27\DLLs', 'C:\Python27\lib', 'C:\Python27 \lib\plat-win', 'C:\Python27\lib\lib-tk', 'C:\Python27', 'C:\Python27\lib\site-packages', ' C:\Python27\lib\site-packages\wx-3.0-msw']
Upvotes: 0