diff --git a/buffer/__init__.py b/buffer/__init__.py index 9743cbc..8cdd57f 100644 --- a/buffer/__init__.py +++ b/buffer/__init__.py @@ -685,14 +685,14 @@ class FileBuffer(Buffer): try: data = self.make_string() if self.windows[0].mode.savetabs: - data = data.replace(" ", "\t").encode(self.codec) - - data = self.write_filter(data) + data = data.replace(" ", "\t") + data = self.write_filter(data.encode(self.codec)) f2 = self._open_file_w(self.path, preserve=False) f2.write(self.bytemark + data) f2.close() - except Exception, e: + #except Exception, e: + except NameError, e: if exists: shutil.copyfile(temp_path, self.path) raise e else: