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 559cbaa commit af6c618Copy full SHA for af6c618
1 file changed
src/spikeinterface/core/recording_tools.py
@@ -132,13 +132,11 @@ def write_binary_recording(
132
file_size_bytes = data_size_bytes + byte_offset
133
134
# Create an empty file with file_size_bytes
135
- file = open(file_path, "wb+")
+ with open(file_path, "wb+") as file:
136
+ # The previous implementation `file.truncate(file_size_bytes)` was slow on Windows (#3408)
137
+ file.seek(file_size_bytes - 1)
138
+ file.write(b"\0")
139
- # The previous implementation `file.truncate(file_size_bytes)` was slow on Windows (#3408)
- file.seek(file_size_bytes - 1)
- file.write(b"\0")
140
-
141
- file.close()
142
assert Path(file_path).is_file()
143
144
# use executor (loop or workers)
0 commit comments