I tried to execute ogr2ogr from python with this shell command:
ogr2ogr.exe --config PG_LIST_ALL_TABLES YES -f "PostgreSQL" -append PG:"host=hostnamet user=username password=password dbname=dbname" nasfile.xml
The quick and dirty solution with os.system
doesn't work. There is no data in the database after run this script:
import os
loadfile = path\\file.xml
command = "C:\\Program Files\\QGIS Chugiak\\bin\\ogr2ogr.exe --config PG_LIST_ALL_TABLES YES -f \"PostgreSQL\" -append PG:\"host=hostname user=username password=password dbname=dbname\" " + loadfile
os.system(command)
What is the right syntax to execute it with subprocess.call
?
No comments:
Post a Comment