From 78ef322e77d2ff26fc2d03396145bad605e26621 Mon Sep 17 00:00:00 2001 From: Lea Vauchier Date: Mon, 8 Apr 2024 17:42:38 +0200 Subject: [PATCH] TMP: update pgsql2shp command --- lidar_prod/tasks/utils.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/lidar_prod/tasks/utils.py b/lidar_prod/tasks/utils.py index 71a864bd..8fa1c61b 100644 --- a/lidar_prod/tasks/utils.py +++ b/lidar_prod/tasks/utils.py @@ -260,22 +260,16 @@ def request_bd_uni_for_building_shapefile( sql_select_list = [sql_batiment, sql_reservoir] sql_request = sql_territoire + " UNION ".join(sql_select_list) - cmd = [ - "pgsql2shp", - "-f", - shapefile_path, - "-h", - bd_params.host, - "-u", - bd_params.user, - "-P", - bd_params.pwd, - bd_params.bd_name, - sql_request, - ] + cmd = f"""pgsql2shp -f {shapefile_path} \ + -h {bd_params.host} \ + -u {bd_params.user} \ + -P {bd_params.pwd} \ + {bd_params.bd_name} \ + \"{sql_request}\"""" + # This call may yield try: - subprocess.check_output(cmd, stderr=subprocess.STDOUT, timeout=120) + subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, timeout=120) except subprocess.CalledProcessError as e: # In empty zones, pgsql2shp does not create a shapefile if (