From 922a64661978d71a0d0a78ce51a44adf4b1927e5 Mon Sep 17 00:00:00 2001 From: Alessandro Amici Date: Mon, 8 Apr 2019 10:33:39 +0200 Subject: [PATCH] Open GRIB files in binary mode, relevant for Python 3 --- examples/python/high_level_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/python/high_level_api.py b/examples/python/high_level_api.py index 17925d4f5..bad34a46d 100644 --- a/examples/python/high_level_api.py +++ b/examples/python/high_level_api.py @@ -388,7 +388,7 @@ class TestBufrMessage(unittest.TestCase): """Message can be serialized to file.""" with BufrFile(TESTBUFR) as bufr_file: msg = BufrMessage(bufr_file) - with open(TEST_OUTPUT, "w") as test: + with open(TEST_OUTPUT, "wb") as test: msg.write(test) os.unlink(TEST_OUTPUT) @@ -439,7 +439,7 @@ class TestBufrMessage(unittest.TestCase): bufr['unexpandedDescriptors'] = ivalues bufrin.unpack() bufrin.copy_data(bufr) - with open(TEST_OUTPUT, 'w') as test: + with open(TEST_OUTPUT, 'wb') as test: bufr.write(test) os.unlink(TEST_OUTPUT)