From 8e523815db6929513eccbe7fbde491198ad96d26 Mon Sep 17 00:00:00 2001 From: Erin Sheldon Date: Tue, 20 Aug 2024 14:10:57 -0400 Subject: [PATCH] force bytes to str --- fitsio/fitslib.py | 5 ++++- fitsio/tests/test_image_compression.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fitsio/fitslib.py b/fitsio/fitslib.py index 5e6dc88..2dc72f9 100644 --- a/fitsio/fitslib.py +++ b/fitsio/fitslib.py @@ -1862,7 +1862,10 @@ def get_dither_seed(dither_seed): 1-10_000: use the input seed """ - if isinstance(dither_seed, (str, bytes)): + if isinstance(dither_seed, bytes): + dither_seed = str(dither_seed, 'utf-8') + + if isinstance(dither_seed, str): dlow = dither_seed.lower() if dlow == 'clock': seed_out = 0 diff --git a/fitsio/tests/test_image_compression.py b/fitsio/tests/test_image_compression.py index b355c53..c12df4e 100644 --- a/fitsio/tests/test_image_compression.py +++ b/fitsio/tests/test_image_compression.py @@ -263,7 +263,7 @@ def test_compressed_seed(compress, seed_type, use_fits_object, dtype): dither_seed2 = 4 elif seed_type == 'checksum': dither_seed1 = 'checksum' - dither_seed2 = 'checksum' + dither_seed2 = b'checksum' elif seed_type == 'checksum_int': dither_seed1 = -1 # any negative means use checksum