From be74d92c92184025ddbf087bd9287da9322d7c06 Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Thu, 2 Aug 2018 07:57:17 +1000 Subject: [PATCH] Make all paths absolute for arcpy --- generate_heatmaps.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/generate_heatmaps.py b/generate_heatmaps.py index 7e06ea7..c82858d 100644 --- a/generate_heatmaps.py +++ b/generate_heatmaps.py @@ -39,7 +39,7 @@ def parse_yaml(yaml_name): params = {} for line in yaml.split('\n'): if line: - key, val = line.split(':') + key, val = line.split(':', 1) params[key] = val.strip() return params @@ -50,15 +50,15 @@ def process(yaml_name): beach = params['BEACH'] base_name = os.path.splitext(os.path.basename(params['INPUT LAS']))[0] - # Set all paths relative to current script location - input_tif_dir = params['TIF DEM FOLDER'] - mxd_name = params['MAP DOCUMENT'] - symb_lyr_name = params['SYMBOLOGY LAYER'] - clip_poly = params['HEATMAP CROP POLY'] - output_tif_dir = params['TIF HEATMAP FOLDER'] - previous_date = params['PREVIOUS SURVEY DATE'] + # Make all input and output paths absolute + mxd_name = os.path.abspath(params['MAP DOCUMENT']) + clip_poly = os.path.abspath(params['HEATMAP CROP POLY']) + symb_lyr_name = os.path.abspath(params['SYMBOLOGY LAYER']) + input_tif_dir = os.path.abspath(params['TIF DEM FOLDER']) + output_tif_dir = os.path.abspath(params['TIF HEATMAP FOLDER']) # Check if previous survey date was provided + previous_date = params['PREVIOUS SURVEY DATE'] try: int(previous_date) except ValueError: