Skip to content

Commit a4e12e8

Browse files
Support data size length longer than 9 digits in binblockread (#466)
1 parent 0e26865 commit a4e12e8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/instruments/abstract_instruments/instrument.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def binblockread(self, data_width, fmt=None):
271271
as EOL terminators naturally can not be used in binary transfers.
272272
273273
The format is as follows:
274-
#{number of following digits:1-9}{num of bytes to be read}{data bytes}
274+
#{number of following digits:1-F}{num of bytes to be read}{data bytes}
275275
276276
:param int data_width: Specify the number of bytes wide each data
277277
point is. One of [1,2,4].
@@ -291,7 +291,7 @@ def binblockread(self, data_width, fmt=None):
291291
)
292292
else:
293293
# Read in the num of digits for next part
294-
digits = int(self._file.read_raw(1))
294+
digits = int(self._file.read_raw(1), 16)
295295

296296
# Read in the num of bytes to be read
297297
num_of_bytes = int(self._file.read_raw(digits))
@@ -313,7 +313,7 @@ def binblockread(self, data_width, fmt=None):
313313
tries -= 1
314314
if tries == 0:
315315
raise OSError(
316-
"Did not read in the required number of bytes"
316+
"Did not read in the required number of bytes "
317317
"during binblock read. Got {}, expected "
318318
"{}".format(len(data), num_of_bytes)
319319
)

0 commit comments

Comments
 (0)