Open GRIB files in binary mode, relevant for Python 3
@@ -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)
