I use this syntax to convert the byte array dataword (2 bytes for each sample):
data = numpy.fromstring(dataword, dtype=numpy.int16)
same instruction in Python 3.7 returns the error:
TypeError: fromstring() argument 1 must be read-only bytes-like object, not memoryview
dataword = scope.ReadBinary(rlen-4) #dataword is a byte array, each 2 byte is an integer
data = numpy.fromstring(dataword, dtype=numpy.int16)# data is the int16 array
This is the content of data in Python 2.7.14:
[-1.41601562 -1.42382812 -1.42578125 ..., 1.66992188 1.65234375 1.671875 ]
I am expecting to get the same result with Python 3.7.
How am I supposed to use numpy.fromstring() in 3.7?
scope?