We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5f485db commit cc18642Copy full SHA for cc18642
can/io/logger.py
@@ -61,6 +61,8 @@ class Logger(MessageWriter): # pylint: disable=abstract-method
61
".txt": Printer,
62
}
63
64
+ incompatible_gzip = [".blf", ".db"]
65
+
66
@staticmethod
67
def __new__( # type: ignore
68
cls: Any, filename: Optional[StringPathLike], *args: Any, **kwargs: Any
@@ -105,6 +107,10 @@ def compress(
105
107
File will automatically recompress upon close.
106
108
"""
109
real_suffix = pathlib.Path(filename).suffixes[-2].lower()
110
+ if real_suffix in Logger.incompatible_gzip:
111
+ raise ValueError(
112
+ f"The file type {real_suffix} is currently incompatible with gzip."
113
+ )
114
if kwargs.get("append", False):
115
mode = "ab" if real_suffix == ".blf" else "at"
116
else:
0 commit comments