I writing a Python script to read E00 layers and copy each of them to a it's own PostgreSQL/PostGIS table.
I am using the OGR library.
The problem is that it hangs using the method CopyLayer(). I can see the process Python.exe using 30% of the processor, but it just hangs and never complete. There is no error. The dataset is rather small.
Here is the code:
# Ouverture d'une connection à la base de donnée
database_host = "192.168.16.3"
database_name = "acadb"
database_user = "database_user"
database_pw = "mysupersecretpassword"
database_schemas = "cadastre_import"
db_conn = psycopg2.connect(dbname=database_name, host=database_host, user=database_user, password=database_pw)
ogr_conn_string = "PG: host=%s dbname=%s user=%s password=%s schemas=%s" %(database_host,database_name,database_user,database_pw,database_schemas)
ogr_conn = ogr.Open(ogr_conn_string)
# Création d'un "curseur"
cur = db_conn.cursor()
for file in os.listdir(extract_folder):
e00_file = os.path.join(extract_folder, file, file + 'base', file + 'polylot.e00')
input_ds = ogr.GetDriverByName("AVCE00")
f = input_ds.Open(e00_file)
lyr_poly = f.GetLayerByName('PAL')
ogr_conn.CopyLayer(lyr_poly,'file_test', [])
I can't find the problem... Or maybe I am not doing it the right way?