From 258bc7c8c6752e8b5b8cbc4a0a50c25d719a66e2 Mon Sep 17 00:00:00 2001 From: Mike C Date: Tue, 12 Jan 2016 19:00:16 -0500 Subject: [PATCH] Add temp dir to variable used by osmosis startup script to prevent crash on run --- process_maps.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/process_maps.py b/process_maps.py index 81f5689..125cec5 100755 --- a/process_maps.py +++ b/process_maps.py @@ -15,6 +15,7 @@ import subprocess, sys, os, pprint, datetime, argparse, time base_path = os.path.dirname(os.path.realpath(__file__)) +env = os.environ.copy() FNULL = open(os.devnull, 'w') @@ -65,13 +66,14 @@ if __name__ == '__main__': subprocess.run([bunzip2_cmd, os.path.join(dirpath, file)]) print('Processing maps using osmosis') + env['JAVACMD_OPTIONS'] = '-Djava.io.tmpdir=' + os.path.join(base_path, 'tmp') # Setup java temp dir to something a bit more sane (tmpfs /tmp for the loss) files_to_process = [] for dirpath, dirnames, filenames in os.walk('dl'): for file in filenames: print(' Found map: ', end='') print(os.path.join(dirpath, file)) files_to_process.append(os.path.join(dirpath, file)) - osmosis_cmd = [os.path.join(base_path, 'bin', 'osmosis', 'bin', 'osmosis'), '-Djava.io.tmpdir=' + os.path.join(base_path, 'tmp')] + osmosis_cmd = [os.path.join(base_path, 'bin', 'osmosis', 'bin', 'osmosis')] for file in files_to_process: if file.endswith('osm'): osmosis_cmd.extend(['--rx', 'file=' + file]) @@ -80,5 +82,6 @@ if __name__ == '__main__': for x in range(0, len(files_to_process) - 1): osmosis_cmd.append('--merge') osmosis_cmd.extend(['--mapfile-writer', 'file=output.map', 'type=hd']) - subprocess.run(osmosis_cmd) + cmd = subprocess.Popen(osmosis_cmd, env=env) + cmd.wait()