From 427739f66c04b72879a86445f402dfea7a8d3a2d Mon Sep 17 00:00:00 2001 From: olawale williams Date: Thu, 27 Jun 2024 18:20:10 +0100 Subject: [PATCH] added solution to handle dots in filenames properly --- flirimageextractor/flir_image_extractor.py | 9 +++++---- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/flirimageextractor/flir_image_extractor.py b/flirimageextractor/flir_image_extractor.py index 8e1ebc5..18897e8 100644 --- a/flirimageextractor/flir_image_extractor.py +++ b/flirimageextractor/flir_image_extractor.py @@ -411,10 +411,11 @@ def save_images(self, minTemp=None, maxTemp=None, bytesIO=False): ) / (np.amax(self.thermal_image_np) - np.amin(self.thermal_image_np)) if not bytesIO: - thermal_output_filename_array = self.flir_img_filename.split(".") + # use splitext to handle dots in filenames properly. + thermal_output_filename_array = os.path.splitext(self.flir_img_filename) thermal_output_filename = ( thermal_output_filename_array[0] - + "_thermal." + + "_thermal" + thermal_output_filename_array[1] ) @@ -434,12 +435,12 @@ def save_images(self, minTemp=None, maxTemp=None, bytesIO=False): transformed_filename = transform_filename_into_directory( thermal_output_filename, str(palette.name) ) - filename_array = transformed_filename.split(".") + # use splitext to handle dots in filenames properly. + filename_array = os.path.splitext(transformed_filename) filename = ( filename_array[0] + "_" + str(palette.name) - + "." + filename_array[1] ) if self.is_debug: diff --git a/pyproject.toml b/pyproject.toml index 188d49c..8eb32da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "flirimageextractor" -version = "1.5.5" +version = "1.5.6" description = "A small tool/lib to read temperatures and original photos from FLIRĀ® thermal camera images." authors = [ "National Drones ",