diff --git a/src/spexipy/spexical.py b/src/spexipy/spexical.py index 80cd0f3..a641f78 100644 --- a/src/spexipy/spexical.py +++ b/src/spexipy/spexical.py @@ -72,6 +72,8 @@ class SpeXICAL: self.pixel_mask = self._load_frame(np.uint16) self.comment = self._file.read(self.file_size - self._min_size) + if self.comment[-1] == b'\x00': + self.comment = self.comment[:-1] self._file.close() self._file = None @@ -128,6 +130,7 @@ class SpeXICAL: self._store_frame(self.pixel_mask) self._file.write(self.comment) - self._file.write(b'\x00') + if self.comment[-1] != b'\x00': + self._file.write(b'\x00') self._file.close() self._file = None