From ba4b3c074feb41ad6949bd5071ff726d5c9b72da Mon Sep 17 00:00:00 2001 From: toddn Date: Wed, 31 Jan 2024 10:57:14 -0600 Subject: [PATCH] create Path to /neighbors before trying to open file --- mpl_divideimg_234_water_new.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mpl_divideimg_234_water_new.py b/mpl_divideimg_234_water_new.py index 7294c11..9a903d0 100644 --- a/mpl_divideimg_234_water_new.py +++ b/mpl_divideimg_234_water_new.py @@ -11,6 +11,7 @@ import h5py import numpy as np import os +from pathlib import Path from mpl_config import MPL_Config from osgeo import gdal @@ -177,6 +178,9 @@ def divide_image( f2.create_dataset("values", data=values) import pickle + path_to_neighbors = os.path.join(worker_root, "neighbors") + Path(path_to_neighbors).mkdir(parents=True, exist_ok=True) + db_file_path = os.path.join(worker_root, "neighbors/%s_ij_dict.pkl" % new_file_name) dbfile = open(db_file_path, "wb") pickle.dump(dict_ij, dbfile)