-
Notifications
You must be signed in to change notification settings - Fork 633
Fix the compressed BLFWriter #1379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1379 +/- ##
===========================================
+ Coverage 66.21% 66.22% +0.01%
===========================================
Files 86 86
Lines 9021 9027 +6
===========================================
+ Hits 5973 5978 +5
- Misses 3048 3049 +1 |
can/io/blf.py
Outdated
filesize = self.file.tell() | ||
# Write header in the beginning of the file | ||
self.file.seek(0) | ||
self._write_header(filesize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zariiii9003 The call self.file.seek(0)
results in an OSError. It appears that the code block is not required if write mode wb
is used (rather than ab
). However, if the append
option is requested, then some of this idea may be required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The header contains things that are only known after the log has been written, so that's why we need to go back and write it later. Previously we closed and reopened the file to update it, but it seemed unnecessary if it was possible to seek instead.
Remaining tasks:
|
can/io/blf.py
Outdated
filesize = ( | ||
self.file.tell() | ||
) # == self.file.seek(0, 1) if type == gzip.GzipFile | ||
if type(self.file) != gzip.GzipFile: | ||
# Write header in the beginning of the file | ||
self.file.seek(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the type of self.file
is a gzip.GzipFile
, then the self.file.tell()
call appears to enter gzip.seek(0, 1)
. Does it need to be called twice?
The current changes make it so that
|
closes #1378